开发者

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

开发者 https://www.devze.com 2023-03-10 04:29 出处:网络
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)

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 n开发者_运维百科ot 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 ...)

?


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]


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消