Welcome! Log In Create A New Profile

Advanced

Re: Please convert this mod rewrite rule

Francis Daly
April 11, 2011 06:52PM
On Mon, Apr 11, 2011 at 06:15:09PM -0400, alex1950 wrote:

Hi there,

> RewriteRule test-(.*)\.htm$ inc/tesmodrewite.php?q=test_$1
> RewriteRule test2-(.*)\.htm$ /inc/tesmodrewite.php?q=test_$1
> RewriteRule pm-(.*)\.(jpg|png|gif|html)$ index.php?pm=$1

As some starting notes:

* replace "RewriteRule" with "rewrite"
* stick a ";" at the end of the line
* the first character of the request is "/"
* the replacement probably wants to start with "/"
* debug log is your friend

The third note is relevant if your regex starts with "^". None of yours
here do.

For the fourth note, do you want "/a/b/test-c.htm"
to be rewritten to "/inc/tesmodrewite.php?q=test_c" or to
"/a/b/inc/tesmodrewite.php?q=test_c"? (The answer is probably obvious
to one who knows the apache syntax well.) You'll want the leading "/"
either explicitly, or as part of a (new) initial (.*) in the regex and
corresponding $1 in the replacement.

Good luck with it,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Please convert this mod rewrite rule

alex1950 April 11, 2011 06:15PM

Re: Please convert this mod rewrite rule

Francis Daly April 11, 2011 06:52PM

Re: Please convert this mod rewrite rule

alex1950 April 11, 2011 07:56PM

Re: Please convert this mod rewrite rule

Igor Sysoev April 12, 2011 02:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready