I have manually redirected my entire site. The only page that's left is the homepage. How do I redirect my homepage to the new site (http://example.com) but keep my sitemaps on the old domain (www.example.com)? Below is the structure for the sitemap urls:

Main - http://www.example.com/sitemap.xml

Sub - http://www.example.com/sitemap-pt-post-2013-07.xml (Month and year are the only parts that change)

I have tried this and the site redirects but GWT tells me that I dont have a 301 set:

RewriteEngine on
RewriteCond %{HTTP_HOST} olddomain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://newdomain.com/ [L,R=301]


I want to do this so that I could track the 301 in GWT and etc. until things a finalized.

  • Can you clarify your old and new domains... you start of mentioning example.com and www.example.com (one domain, different subdomains) but then use olddomain.com and newdomain.com (two entirely different domains) in your code snippet? Presumably both domains are added to GWT?
    – MrWhite
    Commented Aug 13, 2014 at 19:06
  • My apologies. www.example.com is www.olddomain.com and example.com is newdomain.com . They are both in my GWT account.
    – dasickle
    Commented Aug 13, 2014 at 19:10
  • You also state that you've "manually redirected my entire site", but "the only page that's left is the homepage" - which you are now redirecting. How have you redirected your entire site, but avoided the homepage and sitemaps? Is it possible that this is conflicting as you state below that "it only redirects the example.com and not www.example.com"? The above directives should work to redirect the homepage only from both www.olddomain.com and olddomain.com - although it could probably be simplified (assuming you are already dealing with direct requests for the index document?).
    – MrWhite
    Commented Aug 13, 2014 at 19:42
  • I redirected every page on the site by using Redirect 301 /oldpage/ newsite.com/newpage. There doesn't seem to be any issues. With this directive only the non www old domain is going to the new domain.
    – dasickle
    Commented Aug 13, 2014 at 19:49
  • Does the Redirect directive work to redirect both the non-www and www versions to the new domain? Generally, you should not mix both mod_alias (Redirect) and mod_rewrite (RewriteRule) directives since the order of execution is not obvious and you can end up with unexpected conflicts. However, that probably isn't the problem in this case.
    – MrWhite
    Commented Aug 13, 2014 at 20:21

2 Answers 2


I was able to get it to work using the following:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
Rewriterule ^(.*) http://newdomain.com/ [L,R=301]

Answer provided here:

301 redirect doersnt work in SERP


Unless you've left out essential information: just add a 301 redirect for the homepage only and your sitemaps and webmaster authentication will keep on functioning.

  • I got that part but for some reason it only redirects the example.com and not www.example.com.
    – dasickle
    Commented Aug 13, 2014 at 18:25
  • Could be that www is pointing somewhere else.
    – the
    Commented Aug 13, 2014 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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