OC2PS
OC2PS

Reputation: 1069

URL rewriting in nginX

We currently run Apache and use .htaccess to rewrite URLs in several scripts including WordPress and OpenCart.

For performance reasons, we would like to move to a nginX+Varnish stack. How can we handle URL rewriting in nginX, and can we automate it, just the way WordPress and OpenCart write (into) .htaccess

Upvotes: 0

Views: 292

Answers (1)

user1376704
user1376704

Reputation:

location ^~ /location {
  # some code else rewrite
  rewrite ^/your_rules # Or
  try_files $uri @rewrite_loc;
}

location @rewrite_loc {
  # some code
  # I guess you are not talking about proxy_pass
}

yes you can use Nginx just how you use with Apache and .htaccess, just need to define good rewrite rules.

Upvotes: 2

Related Questions