Giving WordPress its own subdirectory – nginx

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

Leave a Comment