Rewrite conversion
Tseveendorj Ochirlantuu
tseveendorj at gmail.com
Fri Nov 11 13:17:04 UTC 2011
Dear Igor,
You have converted apache rewrite to nginx. I appreciated very much for you.
But I need redirecting request www to non-www in my rewrite. Please
see your converted rewrite below.
Any help will be appreciated.
server {
...
root /path/to/files;
error_page 403 /index.php?do=/public/error/403/;
error_page 404 /index.php?do=/public/error/404/;
location /file/ {
}
location /install/ {
}
location /design/ {
}
location /plugins/ {
}
location = /robots.txt {
}
location = /favicon.ico {
}
location / {
fastcgi_pass ...
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;
fastcgi_param QUERY_STRING do=$uri;
}
location /index.php {
location = /index.php {
fastcgi_pass ...
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;
fastcgi_param QUERY_STRING $args;
}
location ~ ^/index.php(/.*)$ {
fastcgi_pass ...
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;
fastcgi_param QUERY_STRING do=$1;
}
return 404;
}
On 7/25/11, Tseveendorj <tseveendorj at gmail.com> wrote:
> On 11.07.23 23:05, Edho Arief wrote:
>> On Sat, Jul 23, 2011 at 9:33 PM, Tseveendorj Ochirlantuu
>> <tseveendorj at gmail.com> wrote:
>>> Dear Igor,
>>> I just tested rewrite but one thing did not work. When I'm
>>> accessing
>>> http://www.xac.mn/index.php?do=/mytunes/view/song_40/module_popout/ this
>>> popup but I got
>>>
>>> 404 Not Found
>>>
>>> ________________________________
>>> nginx/0.7.65
>>> on the screen. Above url is working on Apache with rewrite.
>>> I do not know difference between these two rewrites.
>>> Apache
>>> RewriteRule ^(.*)$ /index.php?do=/$1 [L]
>>> Nginx location ~ ^/index.php(/.*)$ { fastcgi_pass backend;
>>> include fastcgi_params; fastcgi_param
>>> SCRIPT_FILENAME /var/www/xac/index.php;
>>> fastcgi_param QUERY_STRING do=$1; }
>>>
>> the url
>> http://www.xac.mn/index.php?do=/mytunes/view/song_40/module_popout/
>> is handled by this location block:
>>
>> location = /index.php {
>> fastcgi_pass ...
>> include fastcgi_params;
>> fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;
>> fastcgi_param QUERY_STRING $args;
>> }
>>
>> _______________________________________________
>> nginx mailing list
>> nginx at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
> Really, I thought above rewrite handled by another. What do you think
> this popup does not work ?
>
>
>
>
More information about the nginx
mailing list