Difference between revisions of "Wordpress Ngnix Rewrite Rules"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==Wordpress + Nginx Rewrite Rules== After installing Nginx you noticed that it does not play nice with the default .htaccess rewrite rules. You will want to add the followin...")
 
(No difference)

Latest revision as of 04:19, 9 February 2014

Wordpress + Nginx Rewrite Rules

After installing Nginx you noticed that it does not play nice with the default .htaccess rewrite rules.

You will want to add the following to your vhost file for nginx.

To get the default wordpress to function correctly without custom rewrite rules, add the following to your vhost file.

vim /path/to/your/vhost.conf 

Add the following

if (!-e $request_filename) {
   rewrite ^(.+)$ /index.php?q=$1 last;
}

Now check and make sure all syntax is correct

nginx -t

Then restart nginx if all is correct

/etc/init.d/nginx restart