Portal Home > Knowledgebase > Articles Database > rewrite for php script, expert advice appreciated
rewrite for php script, expert advice appreciated
Posted by devonblzx, 01-20-2013, 01:52 AM |
My goal is to rewrite a URL for nginx, but I found much more help for Apache. I also found an nginx converter, so whether you are an expert in mod_rewrite or nginx rewrite, I'd appreciate your help.
I am trying to rewrite a url like so:
index.php/value1/value2/value3/misc=misc&test=test&any=here
to:
index.php?var1=value1&var2=$value2&var3=value3&misc=misc&test=test&any=here
So I will have three variables that are fixed, and the rest are dynamic.
The code I have come up with is:
Using the converter at http://www.anilcetin.com/convert-apa...cess-to-nginx/, it gave me this for nginx:
Do you see any issues with this rule and if so, please advise me.
Thank you for your time.
|
Posted by Ari Sultani, 01-20-2013, 04:30 AM |
I found this on Nginx book.
Rewrite rules
The most common source of worries during an HTTP server switch is the rewrite
rules. Unfortunately, Nginx is not directly compatible with the Apache rewrite rules
in two regards:
Usually, rewrite rules are placed within .htaccess files, as discussed in the
previous section. Nginx offers no such mechanism, so rewrite rules will have
to be placed in a different location.
The syntax of the rewrite instructions and conditions is quite different and
will need to be adapted.
This section will approach some of the issues encountered when porting rules
to Nginx, and then will provide some prewritten rules for a couple of major
web applications.
Apache Module Nginx Module Status Configure switch
mod_rewrite rewrite Included by default --without-
|
Posted by gnusys, 01-20-2013, 09:15 AM |
Hi,
Does the rewrite rule you have come up with work with apache?.Test it first with apache and use the working rule in apache in http://winginx.com/htaccess
or
http://www.anilcetin.com/convert-apa...cess-to-nginx/
Best of luck
|
Add to Favourites Print this Article
Also Read