Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 that after archives there is a wildcard char).

Can someone here please help me with the code for .htaccess rules?

share|improve this question
I've updated my answer pl. see it. – AgA Jan 27 '14 at 6:29

I assume you want to redirect permanently:

RedirectMatch 301 ^/archives/.*  http://www.example.com/news

I've placed this rule in www.tariffplansindia.com test it there.

Here is another:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com/archives [NC]
RewriteRule ^archives/(.*) http://example.com/news [R=301,L]

I've placed this rule in www.rtidiary.org test it there.

share|improve this answer
Hi would the term "RedirectMatch" work in htaccess? Thanks a lot! – user3236765 Jan 26 '14 at 4:41
Hi tried adding the line above to .htaccess and it didn't work! Please assist. Thanks! – user3236765 Jan 26 '14 at 4:51
Hi I tried looking for any mention of "alias" in the .htaccess file and there is none! Can you please give me the complete code? Thanks! – user3236765 Jan 26 '14 at 4:56
It didn't work I added the line above into .htaccess and tried an old url that has the archives in the beginning of the url and it didn't load gave 404. – user3236765 Jan 26 '14 at 5:06
It adds url to the new url: – user3236765 Jan 26 '14 at 5:45

To learn about .htaccess writing rules you can refer the official link of Apache Module mod_rewrite: http://httpd.apache.org/docs/current/mod/mod_rewrite.html.

And for URL rewriting guide: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html.

share|improve this answer
Welcome to Pro Webmasters. – Zistoloen Feb 26 '14 at 10:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.