April 12, 2011 02:20AM
On Mon, Apr 11, 2011 at 06:15:09PM -0400, alex1950 wrote:
> Hi,
>
> <IfModule mod_rewrite.c>
> # Tell PHP that the mod_rewrite module is ENABLED.
>
> SetEnv HTTP_MOD_REWRITE On
> Options +FollowSymLinks
> RewriteEngine on
> 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
> RewriteRule pt-(.*)\.(jpg|png|gif|html)$ index.php?pt=$1
> RewriteRule dt-(.*)\.(jpg|png|gif)$ index.php?dt=$1
> RewriteRule dm-(.*)\.(jpg|png|gif)$ index.php?dm=$1
> RewriteRule di-(.*)\.(jpg|jpeg|png|gif|bmp)$ index.php?di=$1
> RewriteRule page(.*)\.html$ gallery.php?p=$1
> </IfModule>

If you want to use configuraiton which will be easy to maintain in future,
do not use rewrite's:

location /test- {
location ~ ^/test-(.+)\.htm$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/inc/tesmodrewite.php;
fastcgi_param QUERY_STRING q=test_$1;
...
}
}

location /test2- {
location ~ ^/test2-(.+)\.htm$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/inc/tesmodrewite.php;
fastcgi_param QUERY_STRING q=test_$1;
...
}
}

Yes, the configuration will be larger, but every location is independent
and may be changed or new locations may be added without worry how it
will affect other parts of the configuration.


--
Igor Sysoev

_______________________________________________
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: 159
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