Answer the question
In order to leave comments, you need to log in
Is it possible to rewrite rewrites easier?
Good day.
Now I am rewriting apache configs to nginx.
And my question is, can it be made easier?
Here is an example of two RewriteRule apache:
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteCond %{REQUEST_URI} /sitemap.xml [NC]
RewriteRule .* sitemap/example/desktop/sitemap.xml [L]
RewriteCond %{HTTP_HOST} ^example [NC]
RewriteRule .* https://www.example.com%{REQUEST_URI} [R=301,L]
if ($http_host ~* "^www.example.com"){
rewrite ^(.*)$ /sitemap/example/desktop/sitemap.xml break;
}
if ($http_host ~* "^example"){
rewrite ^(.*)$ https://www.example.com$request_uri redirect;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question