Answer the question
In order to leave comments, you need to log in
Setting htaccess to redirect and reverse url substitution?
Hello!
Faced the need to implement the following in htaccess:
RewriteRule ^sitemap.xml$ /index.php?sitemap=xml [L]
RewriteCond %{QUERY_STRING} ^sitemap=xml
RewriteRule (.*) http://site.ru/sitemap.xml? [R=301,L]
Answer the question
In order to leave comments, you need to log in
! - denial
RewriteCond %{QUERY_STRING} (^|&)sitemap\=xml($|&)
(так будет корректней )
RewriteCond %{REQUEST_URI} !sitemap\.xml$
Если не сайтмап
RewriteRule правило
most likely, you just need to swap them, i.e. like this:
RewriteCond %{QUERY_STRING} ^sitemap=xml
RewriteRule ^index\.php$ http://site.ru/sitemap.xml [R=301,L]
RewriteRule ^sitemap\.xml$ /index.php?sitemap=xml [L] ## тут должен быть только L, без R
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question