Reputation: 387
I need some permanent (301) redirection rule to redirect multiple versions of documents to new location.
For example I have:
www.domain.com/about/about.html
www.domain.com/about/about.pdf
www.domain.com/about/about.doc
www.domain.com/about/about.rtf
www.domain.com/about/about.txt
and I need to redirect all of them to:
www.domain.com/about
Also I have URLs like this:
www.domain.com/privacy_policy/privacy_policy.html
www.domain.com/privacy_policy/privacy_policy.pdf
www.domain.com/privacy_policy/privacy_policy.doc
www.domain.com/privacy_policy/privacy_policy.rtf
www.domain.com/privacy_policy/privacy_policy.txt
and I need to redirect all of them to:
www.domain.com/privacy-policy-document
Is there any rules which I can safety apply?
Upvotes: 0
Views: 44
Reputation: 784888
You can use this single rule in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^about/(about)\. /$1 [L,NC,R=302]
RewriteRule ^(privacy_policy)/privacy_policy\. /$1-document [L,NC,R=302]
Upvotes: 2