Dear Igor,<div><br></div><div>I have faced trouble on rewrite when new site installed on nginx. Most script has pre-configured rewrite on apache.</div><div>Do you know what document is very useful for converting apache rewrite to nginx ? I will try learn for myself.</div>
<div><br></div><div>Thank you.</div><div>Tseveen.</div><div><br></div><div> <br><br><div class="gmail_quote">On Sat, Jul 23, 2011 at 4:31 PM, Tseveendorj Ochirlantuu <span dir="ltr"><<a href="mailto:tseveendorj@gmail.com">tseveendorj@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear Igor,<div><br></div><div>Thank you for your conversion. It is working now.</div><div>I never imagine this apache rewrite would be like this.</div>
<div><br></div><div>Thank you very much again.</div><div><br></div><div>
Tseveen.</div><div><div></div><div class="h5"><div><br></div><div><br><div class="gmail_quote">On Sat, Jul 23, 2011 at 4:18 PM, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div>On Sat, Jul 23, 2011 at 04:07:27PM +0900, Tseveendorj Ochirlantuu wrote:<br>
> Hello,<br>
><br>
> I'm trying to convert from apache to nginx rewrite.<br>
><br>
> ErrorDocument 403 /index.php?do=/public/error/403/<br>
> ErrorDocument 404 /index.php?do=/public/error/404/<br>
><br>
> RewriteEngine On<br>
><br>
> RewriteCond %{REQUEST_URI} !^/file/.*<br>
> RewriteCond %{REQUEST_URI} !^/install/.*<br>
> RewriteCond %{REQUEST_URI} !^/design/.*<br>
> RewriteCond %{REQUEST_URI} !^/plugins/.*<br>
> RewriteRule ^index.php(/.*)$ /index.php?do=$1 [L]<br>
><br>
> RewriteCond %{REQUEST_URI} !^/file/.*<br>
> RewriteCond %{REQUEST_URI} !^/install/.*<br>
> RewriteCond %{REQUEST_URI} !^/design/.*<br>
> RewriteCond %{REQUEST_URI} !^/plugins/.*<br>
> RewriteCond %{REQUEST_URI} !^/index.php<br>
> RewriteCond %{REQUEST_URI} !^/robots.txt<br>
> RewriteCond %{REQUEST_URI} !^/favicon.ico<br>
> RewriteRule ^(.*)$ /index.php?do=/$1 [L]<br>
><br>
><br>
> This is my try :D<br>
><br>
> error_page 403 /index.php?do=/public/error/403/;<br>
> error_page 404 /index.php?do=/public/error/404/;<br>
><br>
> rewrite ^index.php(/.*)$ /index.php?do=$1 last;<br>
> rewrite ^(.*)$ /index.php?do=/$1 last;<br>
><br>
> I have difficulty on REQUEST_URI with following paths.<br>
><br>
> any help is appreciated.<br>
<br>
</div></div>server {<br>
...<br>
<br>
root /path/to/files;<br>
<div><br>
error_page 403 /index.php?do=/public/error/403/;<br>
error_page 404 /index.php?do=/public/error/404/;<br>
<br>
</div> location /file/ {<br>
}<br>
<br>
location /install/ {<br>
}<br>
<br>
location /design/ {<br>
}<br>
<br>
location /plugins/ {<br>
}<br>
<br>
location = /robots.txt {<br>
}<br>
<br>
location = /favicon.ico {<br>
}<br>
<br>
location / {<br>
fastcgi_pass ...<br>
include fastcgi_params;<br>
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;<br>
fastcgi_param QUERY_STRING do=$uri;<br>
}<br>
<br>
location /index.php {<br>
<br>
location = /index.php {<br>
fastcgi_pass ...<br>
include fastcgi_params;<br>
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;<br>
fastcgi_param QUERY_STRING $args;<br>
}<br>
<br>
location ~ ^/index.php(/.*)$ {<br>
fastcgi_pass ...<br>
include fastcgi_params;<br>
fastcgi_param SCRIPT_FILENAME /path/to/files/index.php;<br>
fastcgi_param QUERY_STRING do=$1;<br>
}<br>
<br>
return 404;<br>
}<br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></blockquote></div><br></div>
</div></div></blockquote></div><br></div>