Alex
Alex

Reputation: 68440

htaccesss redirect / google webmaster's "change of address"

so I have this in my .htaccess:

Redirect / http://blabla.net/

(which redirects all pages from my old domain, blabla.com, to my new domain - blabla.net)

I also wanted to use "change of address" from the google webmater tools, but it tells me that my old site is not verified (even though it is), and that's because it gets redirected to the new site :)

so how can ignore a single request from .htaccess, like this one:

http://blabla.com/google4befdedcf3629c8a.html

(this should not be redirected to blabla.net/google ...)

?

Upvotes: 2

Views: 2787

Answers (2)

Sticky
Sticky

Reputation: 1082

Just temporarily remove the redirect from htaccess while Google verifies your site, then re-instate the redirect. It should only take about a minute.

Edit: Nevermind, Google will periodically check, and will revoke access if the verification vanishes.

Upvotes: 0

Jason McCreary
Jason McCreary

Reputation: 72971

You can use RewriteCond to check for that specific request.

RewriteCond %{REQUEST_URI} !=/google4befdedcf3629c8a.html

Also, I would encourage you to update your Redirect to respond with a 301 if this is a permanent redirection (the default is 302).

Redirect 301 / http://blabla.net/

UPDATE

RewriteCond uses mod_rewrite, whereas Redirect is mod_alias. So you can't mix and match. I should have explicitly provided the full change if you decide to use RewriteCond. Note that the RewriteEngine does incur overhead. So this may not be the ideal solution.

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !=/google4befdedcf3629c8a.html
RewriteRule ^/(.*) http://blabla.net/$1 [R=301,L]

Upvotes: 2

Related Questions