Rewrite rules

Anton Koldaev koldaevav gmail.com
18 12:38:37 MSK 2011


  :
http://kbeezie.com/view/php-self-path-nginx/

2011/3/18 Sergey Kobzar <sergey.kobzar  itcraft.org>:
>    -  url    /backend.php/login, 
>     /backend.php,    /index.php.
>
>   ,      -  404 :
>
> server {
>    listen 80;
>    server_name test.localhost;
>
>    access_log /var/log/nginx/test.localhost_access.log main;
>    error_log /var/log/nginx/test.localhost_error.log info;
>
>    root /home/www/test/htdocs/web;
>
>    rewrite ^/css/[0-9]+/(.*?)$ /css/$1;
>    rewrite ^/js/[0-9]+/(.*?)$ /js/$1;
>
>    location /backend.php {
>        if (!-e $request_filename) {
>            rewrite ^/(.*) /backend.php?q=$uri;
>        }
>    }
>
>    if (!-e $request_filename) {
>        rewrite ^/(.*) /index.php?q=$uri;
>    }
>
>    include /etc/nginx/fastcgi.inc;
>    }
>
> # cat ./fastcgi.inc
> location ~ \.php$ {
>    fastcgi_pass  127.0.0.1:9000;
>    fastcgi_index  index.php;
>    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
>    include     /etc/nginx/fastcgi_params;
> }
>
>
> .
>
>
> On 03/18/11 00:46, Sergey Kobzar wrote:
>>
>> :)
>>
>>  :
>> RewriteRule ^css/[0-9]+/(.*?)$ /css/$1 [L]
>> RewriteRule ^js/[0-9]+/(.*?)$ /js/$1 [L]
>>
>> # we check if the .html version is here (caching)
>> RewriteRule ^$ index.html [QSA]
>> RewriteRule ^([^.]+)$ $1.html [QSA]
>> RewriteCond %{REQUEST_FILENAME} !-f
>> -   , ..      
>>
>> # no, so we redirect to our front web controller
>> RewriteRule ^(.*)$ index.php [QSA,L]
>>
>>
>>     :
>> rewrite ^/css/[0-9]+/(.*?)$ /css/$1;
>> rewrite ^/js/[0-9]+/(.*?)$ /js/$1;
>>
>> if (!-e $request_filename) {
>> rewrite ^/(.*) /index.php?q=$uri;
>> }
>>
>>   ,      . 
>>   -   .
>>
>> P.S. .    framework symfony -   
>> .
>>
>>
>> On 03/16/11 01:27, Vitaly Tskhovrebov wrote:
>>>
>>>     ?   .
>>>
>>> On 3/16/2011 1:44 AM, Sergey Kobzar wrote:
>>>>
>>>>  .
>>>>
>>>>      Apache rewrite rules  Nginx:
>>>>
>>>> RewriteRule ^css/[0-9]+/(.*?)$ /css/$1 [L]
>>>> RewriteRule ^js/[0-9]+/(.*?)$ /js/$1 [L]
>>>>
>>>> # we check if the .html version is here (caching)
>>>> RewriteRule ^$ index.html [QSA]
>>>> RewriteRule ^([^.]+)$ $1.html [QSA]
>>>> RewriteCond %{REQUEST_FILENAME} !-f
>>>>
>>>> # no, so we redirect to our front web controller
>>>> RewriteRule ^(.*)$ index.php [QSA,L]
>>>>
>>>>   ...
>>>>
>>>>
>>>> _______________________________________________
>>>> nginx-ru mailing list
>>>> nginx-ru  nginx.org
>>>> http://nginx.org/mailman/listinfo/nginx-ru
>>>
>>>
>>> _______________________________________________
>>> nginx-ru mailing list
>>> nginx-ru  nginx.org
>>> http://nginx.org/mailman/listinfo/nginx-ru
>>
>> _______________________________________________
>> nginx-ru mailing list
>> nginx-ru  nginx.org
>> http://nginx.org/mailman/listinfo/nginx-ru
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru  nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>



-- 
Best regards,
Koldaev Anton



nginx-ru