Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Nginx Rewrite rule
PostPosted: Fri Mar 05, 2010 7:04 am 
Offline
Senior Newbie

Joined: Sun Feb 21, 2010 8:53 am
Posts: 10
Hi all

I have the following rewrite working perfectly on an Apache based server:
Code:
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 :shock:

Code:
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/wordpress_params.super_cache; 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!

Code:
"/home/public_html/subdomain.mysite.com/public/my-special-WP-category/index.php" is not found


Many thanks for ANY help with this :)


Top
   
 Post subject:
PostPosted: Fri Mar 05, 2010 9:43 am 
Offline
Senior Newbie

Joined: Thu Feb 18, 2010 1:53 am
Posts: 10
i might suggest using the full URI path's in your rewrite in nginx.
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.


Top
   
 Post subject:
PostPosted: Fri Mar 05, 2010 4:16 pm 
Offline
Senior Newbie

Joined: Sun Feb 21, 2010 8:53 am
Posts: 10
I LOVE YOU I LOVE YOU :oops:

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 :lol:


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group