What is Subdirectory publish?

If your main site is hosted elsewhere, you may now publish a Shifter site as https://example.com/my-shifter-site/  without publishing to your main sites  server.

Note: No nested subdirectory supported. Only single subdirectory is supported.

 

Enabling Subdirectory Publish

1. Navigate to [Settings]

2. Scroll down to the [Subdirectory Setting] section

Subdirectory publish is disabled by default.

3. Input your desired subdirectory name and click [update]

4. Subdirectory publish is now enabled

5. Navigate back to your site's [Overview] page. Then, start WordPress.

 WordPress will now operate as a subdirectory install.  

6. Generate a new artifact and publish.

7. Your sites artifact will now be published in a subdirectory. 

 

Some notes on enabling subdirectory support

The path to the media on your posts will not be changed if you change the name of the subdirectory.

For instance, if you update the name of your subdirectory from name-of-subdirectory to renamed-subdirectory or you simply delete the subdirectory name from the Shifter dashboard, the paths to the media files on your posts will still exist as name-of-subdirectory .

Example

  • Current subdirectory name: name-of-subdirectory 
  • Path to media: /name-of-subdirctory/wp-content/uploads/2019/12/example.png 
  • New subdirectory name: new-name-of-subdirectory 
  • A new path to media: /name-of-subdirctory/wp-content/uploads/2019/12/example.png 
  • Subdirectory Disabled: 
  • A new path to media: /name-of-subdirctory/wp-content/uploads/2019/12/example.png  

Solution

  • You can rename the media file paths by using a search and replace plugin such as Better Search Replace or Search Replace.
  • If you only have a few media files, you can rewrite the path directly within the Block Editor (use Edit as HTML feature)
  • Be sure to replace your files url with the same path as your updated WordPress subdirectory name.
     

Be sure to generate and publish a new artifact to see your subdirectory settings reflected on your published site.

Handling with robots.txt and sitemap.

  • You can get robots.txt under  /{name-of-subdirectory}/robots.txt  while the generator is running.
  • You may also find sitemap.xml under /{name-of-subdirectory}/sitemap.xml.
Did this answer your question?