Rewrite conversion

Tseveendorj Ochirlantuu tseveendorj at gmail.com
Sat Jul 23 07:07:27 UTC 2011


Hello,

I'm trying to convert from apache to nginx rewrite.

ErrorDocument 403 /index.php?do=/public/error/403/
ErrorDocument 404 /index.php?do=/public/error/404/

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteRule ^index.php(/.*)$ /index.php?do=$1 [L]

RewriteCond %{REQUEST_URI} !^/file/.*
RewriteCond %{REQUEST_URI} !^/install/.*
RewriteCond %{REQUEST_URI} !^/design/.*
RewriteCond %{REQUEST_URI} !^/plugins/.*
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteRule ^(.*)$ /index.php?do=/$1 [L]


This is my try :D

error_page 403 /index.php?do=/public/error/403/;
error_page 404 /index.php?do=/public/error/404/;

rewrite ^index.php(/.*)$ /index.php?do=$1 last;
rewrite ^(.*)$ /index.php?do=/$1 last;

I have difficulty on REQUEST_URI with following paths.

any help is appreciated.

Thank you.
Tseveen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110723/18e11080/attachment.html>


More information about the nginx mailing list