Forum: NGINX Same rewrites for different directories?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C3ab146b8cf153e371e60a6f288f7188?d=identicon&s=25 Joe Shang (Guest)
on 2008-11-24 21:43
(Received via mailing list)
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
This topic is locked and can not be replied to.