What is publishing to a subdirectory?
Even if your main site is hosted elsewhere, you can now publish your Shifter site at
https://example.com/my-shifter-site/
without publishing it to the main site’s server.
Note:
Nested subdirectories are not supported. Only a single subdirectory is supported.
Enabling Subdirectory Publishing
Go to the [Live] menu for your website
Go to the [Subdirectory] menu
Subdirectory publishing is disabled by default.
Toggle the switch to enable it, enter the desired subdirectory name, and click [update]
Subdirectory publishing is now enabled
Return to the site’s [Overview] page. Next, launch WordPress.
WordPress will run as a subdirectory installation.Generate and publish a new artifact.
Your site’s artifact will be published to the subdirectory.
Important Notes When Enabling Subdirectory Support
Renaming the subdirectory will not change the paths of media files in your posts. You’ll need to manually rename or replace them. For example, if you update the subdirectory name from
name-of-subdirectory to renamed-subdirectory
, or if you remove the subdirectory name from the Shifter dashboard, the path to the post’s media files will remain
name-of-subdirectory.
Example
- Current subdirectory name:
name-of-subdirectory - Path to media:
/name-of-subdirectory/wp-content/uploads/2019/12/example.png - New subdirectory name:
new-name-of-subdirectory - New path to media:
/name-of-subdirectory/wp-content/uploads/2019/12/example.png - Subdirectory disabled: New media path:
/name-of-subdirectory/wp-content/uploads/2019/12/example.png
Solution
You can use search-and-replace plugins such as Better Search Replace or Search
Replace to rename the paths of your media files. If you have only a few media files, you can rewrite the paths directly within the Block Editor (using the “Edit as HTML” feature).
Replace the file URLs with paths that match the updated WordPress subdirectory name.Be sure to generate a new artifact and publish it so that the subdirectory settings are reflected on your live site.