Nginx Rewrite rule
I have the following rewrite working perfectly on an Apache based server:
RewriteRule my-special-WP-category/(.*)$ ?my-ugly-variable=$1
However no matter what variation of the following I put in /usr/local/nginx/sites-available/mysite.com on my Nginx Server I get no redirect
if (!-e $request_filename) {
rewrite my-special-WP-category/(.*)$ ?my-ugly-variable=$1 last;
break;
}
By placing the rewrite code before the include /usr/local/nginx/conf/wordpressparams.supercache; line I get a 500 Internal Server Error and in the logs this: "the rewritten URI has a zero length"
The only other thing I have seen in the sites' logs is the following error which makes me think that Nginx is looking for a real directory instead of the WP virtual one with one of my desperate varations!
"/home/public_html/subdomain.mysite.com/public/my-special-WP-category/index.php" is not found
Many thanks for ANY help with this
2 Replies
So something like
if (!-e $request_filename) {
rewrite my-special-WP-category/(.*)$ /index.php?my-ugly-variable=$1 last;
break;
}
Or what ever script you are executing in the redirect.
Sory man, thanks so much for this that simple piece of code has FINALLY sorted this.
Thank again and apologies for the first over the top reply