Forum Moderators: open

Message Too Old, No Replies

Wildcards in server redirection

Will Google follow and correct?

         

Arnett

5:47 am on Sep 5, 2003 (gmt 0)

10+ Year Member



Google claims to honor wildcards in .htaccess exclusion directives. Will it follow the following directives?

RedirectPermanent /hostname/virtual_path/site1/* [site1.com...]
RedirectPermanent /hostname/virtual_path/site2/* [site2.com...]
RedirectPermanent /hostname/virtual_path/site3/* [site3.com...]

jdMorgan

2:13 pm on Sep 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Arnett,

Will it follow the following directives?

RedirectPermanent /hostname/virtual_path/site1/* [site1.com...]
RedirectPermanent /hostname/virtual_path/site2/* [site2.com...]
RedirectPermanent /hostname/virtual_path/site3/* [site3.com...]

No and yes...
The directives above are invalid. Have another look at Apache mod_alias [httpd.apache.org]. The use of asterisks for wildcarding is not necessary when using Redirect or its variants such as RedirectPermanent. They use prefix-matching, not exact matching. Therefore, wildcarding is the default behaviour of these directives.

(Actually, in order to *not* do wildcarding, you must use RedirectMatch instead.)

The first of the following directives will redirect requests for /hostname/virtual_path/site1/<anything> to [site1.com...]


RedirectPermanent /hostname/virtual_path/site1/ http://www.site1.com/
RedirectPermanent /hostname/virtual_path/site2/ http://www.site2.com/
RedirectPermanent /hostname/virtual_path/site3/ http://www.site3.com/

The question, "Does Google honor wildcards in .htaccess exclusion directives?" Also has a yes and no answer: Google does not honor .htaccess. It cannot see .htaccess. It, like all user-agents, only sees the effects of your server processing .htaccess. In the case above, the server processes .htaccess, and returns a 301-Moved Permanently server response if any requested URI matches the URL-path of any of the RedirectPermanent directives. It is then up to the user-agent to extract the new URI from the 301 response header, and re-issue a request for the desired resource from the new URI. Yes, Google will do this when it deep-crawls.

There is on-going debate/discussion here on WebmasterWorld as to how to best accomplish relocations. The gist of it is that it will take some time, your page rank may suffer temporarily, and that a 301 redirect by itself is not the best solution. Speaking only for myself, I'd do it this way:

  1. Copy the page to the new location.
  2. Update all links on all sites which you control to point to the new location.
  3. Get as many external backlinks as you can pointed to the new location (e-mail the webmasters).
  4. Wait until the search engines pick up the change (the SEs that are important to your site).
  5. Install the 301 redirects.
  6. Remove the old pages.
  7. Leave the 301 redirects in place for as long as possible/necessary to catch old user bookmarks and slow-to-update spiders.

This works for me. YMMV.

Jim

Arnett

9:25 am on Sep 6, 2003 (gmt 0)

10+ Year Member



Thanks for the input but you're not getting the problem. The pages have not moved. When I first started with my web host I used virtual hosting.

[my-host.com...]
[my-host.com...]
[my-host.com...]

As the directories start gaining search position I then licensed:

[my-directory-1.com...]
[my-directory-2.com...]
[my-directory-3.com...]

The problem is that Google is indexing files from both domains and penalizing my domains for DUPLICATE CONTENT. They are the SAME FILE. I only want Google to index the new domains and urls but NOT the virtual hosted urls. I also want the inbound links to the old virtual domains to point to the new domains.

I can't use a 301 handler because the files are in the same directory. No files have moved. Basically [my-host.com...] is NOW called [my-directory-X.com...]

I don't feel that I should be penalized by Google for this. THERE ARE NO DUPLICATE FILES. THEY ARE THE SAME FILE. GOOGLE JUST INSISTS ON CALLING THEM BY DIFFERENT NAMES. I HAVEN'T DONE ANYTHING but license a domain to replace formerly virtually hosted files.

Yidaki

10:07 am on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>I can't use a 301 handler because the files are in the same directory.

Of course you can! And it's the only way to tell google what's going on!

>THERE ARE NO DUPLICATE FILES

As long as google gets the same files from my-host.com/my-directory-1/ and www.my-directory-1.com it IS duplicate content! Either 404 the old directory or 301 to the new location using absolute urls.

jdMorgan

11:22 pm on Sep 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Arnett,

> I can't use a 301 handler because the files are in the same directory. No files have moved. Basically [my-host.com...] is NOW called [my-directory-X.com...]

You can still use the code above, just omit step 6 (don't delete the pages). Alternatively, you may be able to use RedirectMatch's back-reference capability to do it all with one directive:


RedirectPermanent /(my-directory-X)/(.*) http://www.$1.com/$2

Here, $1 is replaced by the first parenthesized group in the pattern, and $2 by the second. If your real "my-directory-X" URIs are distinctive enough, this will work, and save you lots of extra lines.

Jim

Arnett

3:31 am on Sep 7, 2003 (gmt 0)

10+ Year Member



You can still use the code above, just omit step 6 (don't delete the pages).

Thanks. I'll relay that to my webhost.