Knowledgebase

nginx rewrite rules

Posted by WW_P, 08-03-2010, 08:57 PM
Anyone good with them? Ive read the docs at the wiki, but i just dont get it :/ That is my usual vhost: (yes the port is right, yes i know that it is not 80) I try to rewrite this: /index.php?page=2 (page=3 and so on) to /p2 /p3 and so on this is the rule i tryed: rewrite "^/p$" /index.php?page=$1 last; does not work Any help? I also try to rewrite those: /index.php?section=ABC&page=1 to /s/ABC/1 (/s/ABC/2 and so on) /download.php?ABC to /dl/ABC and: /nfo.php?ABC to /r/ABC Any help would be greatly appreciated Thanks, Zhang

Posted by RJohnson23, 08-04-2010, 02:34 AM
The rewrite rules use regex. You need to capture the number with ([0-9]) then you can use it as $1 in the URL to be rewritten as..

Posted by WW_P, 08-04-2010, 04:22 AM
i think i give it up, rewrite in nginx just sucks.

Posted by eth00, 08-04-2010, 10:26 AM
Not sucks, just different It works great just doing new rewrite rules can be a headache.

Posted by CoderJosh, 08-06-2010, 04:02 AM
Yes, don't give up, nginx is really great and you'll get used to the rewrite rules after a little while!



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
FDC Down (Views: 724)
yahoo.com? (Views: 623)
creditcard alternative (Views: 613)


Language:

Client Login

Email

Password

Remember Me

Search