: Need help writing .htaccess / Apache rule I have some URLs which are now 404 due to site upgrade. I want all URLs starting with www.example.com/archives/* to point to www.example.com/news (notice
I have some URLs which are now 404 due to site upgrade.
I want all URLs starting with example.com/archives/* to point to example.com/news (notice that after archives there is a wildcard char).
Can someone here please help me with the code for .htaccess rules?
More posts by @Gretchen104
2 Comments
Sorted by latest first Latest Oldest Best
To learn about .htaccess writing rules you can refer the official link of
Apache Module mod_rewrite: httpd.apache.org/docs/current/mod/mod_rewrite.html.
And for URL rewriting guide: httpd.apache.org/docs/2.0/misc/rewriteguide.html.
I assume you want to redirect permanently:
RedirectMatch 301 ^/archives/.* www.example.com/news
I've placed this rule in tariffplansindia.com test it there.
Here is another:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com/archives [NC]
RewriteRule ^archives/(.*) example.com/news [R=301,L]
I've placed this rule in rtidiary.org test it there.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.