user3766432
user3766432

Reputation: 247

How do I redirect just my home page?

I switched URLs and am redirecting each page to the corresponding page on the new site. My site was relatively small, so I just used Redirect 301 / for each page. I'm to the point where the Redirect 301 / is set up for all of the pages except the home page. For example:

Redirect 301 /blog http://newsite.com/blog
Redirect 301 /page-name http://newsite.com/page-name

For the home page I tried to use:

Redirect 301 / http://newsite.com

Which works, except for it redirects every single page on my old site to the home page and overrides all of the other 301 redirects I set up.

I imagine this is fairly simple but I couldn't find anything googling. Also, please let me know if I'm setting up the 301 redirect incorrectly.

Thanks

Upvotes: 2

Views: 59

Answers (1)

anubhava
anubhava

Reputation: 786091

You need to use RedirectMatch directive for this to target specific URL

RedirectMatch 301 ^/$ http://newsite.com

RedirectMatch supports regex as opposed to Redirect.

Upvotes: 1

Related Questions