Proper way to convert an apache rewrite rule

Aleksandar Lazic al-nginx at none.at
Sun Jun 4 22:30:17 UTC 2017


Hi ST.

ST wrote on 04.06.2017:

> Hello,

> I'm new to nginx and try to move an old website from apache to nginx.
> While getting rid of the .htaccess file I've encountered following
> rewrite rule:
>
> RewriteCond %{QUERY_STRING} id=([^&]*) [NC,OR]
> RewriteCond %{QUERY_STRING} daily=([^&]*) [NC]
> RewriteCond %{REQUEST_URI} !mobSpecCycle [NC]
> RewriteCond %{REQUEST_URI} !mobSpecTheme [NC]
> RewriteRule ^rss\/mobSpec([^\/]+)/?$ /rss/mobSpec$1/mobSpec$1_%1.html
> [QSA,NC,L]

> Could you, please, help me to convert it to nginx "the right way"?

You have at least 2 options.

https://winginx.com/en/htaccess
http://nginx.org/en/docs/http/converting_rewrite_rules.html

> Thank you in advance!

-- 
Best Regards
Aleks



More information about the nginx mailing list