Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Looking to convert the follow Apache rewrite rules over to Nginx. We are trying to get this to work on a subdirectory but can't seem to get the syntax down correctly.

RewriteRule ^([^//]+)/?(.{2})?/$ index.php?page=$1 [QSA,L]

RewriteRule ^([^//]+)/?(.*)?/index([0-9]*).ht(m?ml?)$ index.php?page=$1&rlVareables=$2&pg=$3 [QSA,L]

RewriteRule ^([^/][\w\-\_]+)(.+)-l?([0-9]+).ht(m|ml)$ index.php?page=$1&rlVareables=$2&listing_id=$3 [QSA,L]

RewriteRule ^((\w{2})/)?([\w-_]{3,})$ index.php?page=$3&lang=$2&account_request [QSA,L]

RewriteRule ^([^//]+)/?(^/*)?.ht(m?ml?)$ index.php?page=$1 [QSA,L]

RewriteRule ^([^//]+)/?(.*)?/?(.*)?(.ht(m?ml?)|/+)$ index.php?page=$1&rlVareables=$2 [QSA,L]
share|improve this question
up vote 0 down vote accepted
location /something {
  rewrite "^/([^//]+)/?(.{2})?/$" /index.php?page=$1 break;
  rewrite ^/([^//]+)/?(.*)?/index([0-9]*).ht(m?ml?)$ /index.php?page=$1&rlVareables=$2&pg=$3 break;
  rewrite ^/([^/][\w\-\_]+)(.+)-l?([0-9]+).ht(m|ml)$ /index.php?page=$1&rlVareables=$2&listing_id=$3 break;
  rewrite "^/((\w{2})/)?([\w-_]{3,})$" /index.php?page=$3&lang=$2&account_request break;
  rewrite ^/([^//]+)/?(^/*)?.ht(m?ml?)$ /index.php?page=$1 break;
  rewrite ^/([^//]+)/?(.*)?/?(.*)?(.ht(m?ml?)|/+)$ /index.php?page=$1&rlVareables=$2 break;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.