Same rewrites for different directories?

Joe Shang joe.shang at gmail.com
Mon Nov 24 23:36:35 MSK 2008


I am converting a user to nginx, and she has like 2,300 different
.htaccess with the same code, I converted his main public_html one,
and his ar directory one, in short my rewrite result looks like:



if (!-e $request_filename) {
rewrite ^/action/login/$ /login.php;
rewrite ^/action/logout/$ /logout.php;
rewrite ^/action/index/$ /index.php;
rewrite ^/action/devlogin/$ /devLogin.php;
rewrite ^/action/signup/$ /signup.php;
rewrite ^/action/forgotpassword/$ /forgotPassword.php;
rewrite ^/action/verifymail/$ /verifyMail.php;
rewrite ^/action/verifypasswordmail/$ /verifyPasswordMail.php;
rewrite ^/action/searchlist/$ /searchList.php;
}
location /ar/ {
if (!-e $request_filename) {
rewrite ^/ar/action/login/$ /ar/login.php;
rewrite ^/ar/action/logout/$ /ar/logout.php;
rewrite ^/ar/action/index/$ /ar/index.php;
rewrite ^/ar/action/devlogin/$ /ar/devLogin.php;
rewrite ^/ar/action/signup/$ /ar/signup.php;
rewrite ^/ar/action/forgotpassword/$ /ar/forgotPassword.php;
rewrite ^/ar/action/verifymail/$ /ar/verifyMail.php;
rewrite ^/ar/action/verifypasswordmail/$ /ar/verifyPasswordMail.php;
rewrite ^/ar/action/searchlist/$ /ar/searchList.php;
}
        }


I cut it short, but hopefully you get the idea.

User has hundreds of directories using the same rules.

There has to be an easier way on nginx without me having to add /ar
/ar , etc as I did above to each different directory?

Is there an easier way?

Joe





More information about the nginx mailing list