htaccess – Giving WordPress its own subdirectory – nginx

Question

I want to move WordPress installation to a subdirectory without affecting site url – https://wordpress.org/support/article/giving-wordpress-its-own-directory/ (method 1)

The article contains only instructions for Apache2. How would it translate to nginx site configuration?

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>

0
Maciej Krawczyk 3 weeks 2021-09-03T00:15:07-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse