Forum Moderators: phranque

Message Too Old, No Replies

Redirecting a subdomain (for search engines)

Using transparent redirects for search engines

         

Bluestreak

4:17 am on Dec 9, 2002 (gmt 0)

10+ Year Member



Hi all,

I recently created a subdomain for my website which I want to redirect to a certain set of PHP driven pages located in my primary domain's root directory. These pages rely on being in the primary domain's root to work, which is why I can't simply move them into the subdomain's root directory.

With this in mind, what kind of redirect should I implement in the subdirectory. Right now Im using htaccess redirect, which works fine, but Im not sure it's appropriate since I havent permanently moved anything, as the 301 error implies. I do want to redirect to basically tell the search engines like Google, "Hey don't index this page, start indexing at the page I'm redirecting you to."

Is htaccess ok for this, or is there another solution? Thanks for any help :-)

jdMorgan

5:01 am on Dec 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bluestreak,

Your use of 301-Moved Permanently is correct in this case.

The use of the term "301 Error" is specific to MS IIS, AFAIK. 400-series server response codes indicate an error on the part of the requestor, e.g. 404 indicates the requestor is asking for a non-existant page. 300-series response codes are informational.

As long as you are redirecting to spiderable URLs in your site root directory, you should be fine. If you are redirecting to long, spider-unfriendly URLs, you might consider adding a "silent" internal redirect in your root from a spider-friendly URL in root to the type of URL required by the scripts in root. In this case, there is no requirement that a file exists to correspond to the spider-friendly URL - you are just using the friendly name as an alias, and the silent internal redirect will deliver the requests to the scripts.

subdirectory_domain--301 redirect-->spider_friendly_URL_in_root--internal redirect-->script_URL_in_root.

Jim

Bluestreak

5:23 am on Dec 9, 2002 (gmt 0)

10+ Year Member



Thanks for the response, it was very informative. The URL I'm redirecting it to is very spider friendly, as evident by the hordes of Googlebots that raid the site on a regular basis. One more question, is it necessary to have any additional files in the subdomain's directory, or is the htaccess file all by itself enough? Currently I have the htaccess file written like this:

*************************
Redirect /index.html [xxxxxxx.com...]
Redirect /index.php [xxxxxxx.com...]
*************************

I think I'm being too redundant, especially since the index.html(php) files never existed. Would this be better:

******************************
Redirect [xxx.com...]
******************************

Appreciate the help :D

jdMorgan

5:45 am on Dec 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bluestreak,

The directives you posted will result in a 302-Moved Temporarily redirect, so most spiders will continue to ask for the subdirectory, not the root directory. Is that what you want? If not, then use RedirectPermanent.

Redirect uses prefix matching, so you can just omit the "html" and "php":


Redirect /index. http://www.xxxxxxx.com/
- or even:

Redirect / http://www.xxxxxxx.com/
which would redirect everything.

It's not necessary to have any other files in the subdirectory. You may not even need the subdirectory to exist; You could use .htaccess in root to redirect requests for that subdirectory directly to the scripts. I guess it all depends on how a spider gets into the subdirectory in the first place...

Jim

Bluestreak

6:35 am on Dec 9, 2002 (gmt 0)

10+ Year Member



Whoops, didnt realize there was a different commandline for a permanent redirect. Thanks for the heads up. I modified the htaccess to:

**************************
RedirectPermanent / [xxxxxxx.com...]
**************************

That appears to have done the trick. Thanks again for your help. :D

turk182

10:00 am on Dec 9, 2002 (gmt 0)

10+ Year Member



A little off-topic.

How would you do the same thing in IIS and make it "Google friendly". Actually we have a <% response.redirect("http://www.xxxx.com/xxxx/xxxx.asp %>, and Google has indexed both pages under two diferent paths (so we have the same page indexed twice).

jdMorgan

5:53 pm on Dec 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



turk182,

I'm an Apache guy, so I don't know. I'd suggest posting your question as a new topic, and specify IIS in the title of the post. I'm sure it can be done, just don't know how on IIS.

Jim