How do you do multiple redirects in a .htaccess file?

Can someone please give me the full code for a multiple redirect in an .htaccess file? This is what I want to do:

  1. Redirect the main page to another site ( to
  2. Redirect to
  3. Redirect to
  4. Redirect to

All other pages would redirect as the main page. I just need a few pages to be exempt. It would be nice to also know how to do a fourth or even more that would be exempt, too. Please give me the entire code as I’m not sure how to do this. Thank you.

This question is best suited for Server Configuration so I moved it there. Nothing in your question relates to HTML&CSS.

1 Like

Welcome to the forums, @premack.

Redirect 301 /index.html /
Redirect 301 /design /
Redirect 301 /resources /
Redirect 301 /articles /

That should redirect those pages/directories you’ve specified, but I don’t know how you would redirect all others to, except by specifying them individually. Hopefully somebody else can offer a better solution.

This might be of interest:

May I suggest using 302 redirection instead of 301 because 302 is only a temporary redirect. The global DNS Routers will not permanently store the redirection and check your site to ensure the temporary redirection is still valid.

After a couple of days and you are absolutely sure all redirections are working satisfactorily then change the 302 redirection to 301 to make the redirection permanent.

The reason is that once the 301 has been registered it is tremendously difficult and virtually impossible to revoke.

Unfortunately I have the T-Shirt :frowning:


Thank you! I will test this code out and let you know if it works.

A 302? Oh dear, now I’m torn as to which to do… Thank you for the suggestion. I’m worried now that if I try the 301 code I will permanently ruin my domain?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.