1

Ive got an old website that i want to 301 redirect to another website (using .htaccess). I want to claim ownership of the property in Google Webmaster tools, to do this i usually use the file upload option, the only issue is that if i do this it cant be verified because when google checks for the file, it gets redirected.

The other option is that i set the verification file, tell google to verify, then set the 301, this works, but after a while it seems that google then looks again for the verification, cant find it and thus remarks the site as unverified in the Webmaster tools.

Any ideas how i can get around this ?

1
  • I've found verification via Google Analytics seems to work even with a redirect in place. Commented Aug 9, 2015 at 23:38

3 Answers 3

3

Try this:

RewriteCond %{REQUEST_URI} !^/mygooglefile.txt$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Of course you will need to change the file name and the target domain name.

2

Your best option is probably to verify using DNS. This will work no matter what sort of redirects you have in place. It also doesn't require you to keep up with any special redirect rules.

According to Google's help page, you should:

  1. On the Search Console Home page, click the Manage Site button next to the site you want, and then click Verify this site.
  2. Click the Alternate methods tab.
  3. Select Domain name provider.
  4. Select your domain registrar and follow the instructions on your screen. If your domain registrar isn't listed, select Other, and follow the instructions to manually create a DNS record.
  5. Click Verify. Removing the record from your server can cause your site to become unverified, and you will need to go through the verification process again.
1
  • thanks, this is the conclusion i came to as well, ill let you know how it goes
    – sam
    Commented Aug 10, 2015 at 20:39
0

Even with the file verification method, the verification bot will follow redirects to the verification file. You can put the verification file onto your actual domain and then verify your redirect domain.

For example if you want to verify example.org but it redirects to example.com, you can use the "URL prefix" method like this:

URL prefix Google Search Console verification

You can then use the HTML file upload verification like this:

HTML File Upload Verification for Google Search Console

Google will ask you to upload the file to example.org but you can actually upload it to example.com. So if your file is google123abc.html then it can be available at http://example.com/google123abc.html. As long as http://example.org/google123abc.html redirects to that (and not to the home page), Google Search Console verification will succeed.

If you have already verified example.com with the HTML file method, you should already have the HTML file in place. Then you can just verify the domain without re-uploading anything.

I just tested this by verifying my alternate domain that redirects to my main domain.

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.