homepage Welcome to WebmasterWorld Guest from 54.226.213.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Google / Google SEO News and Discussion
Forum Library, Charter, Moderators: Robert Charlton & aakk9999 & brotherhood of lan & goodroi

Google SEO News and Discussion Forum

    
I published a subdomain, but it's indexed as a subdirectory
specter




msg:3417143
 7:14 pm on Aug 8, 2007 (gmt 0)

Hello,

I have a subdomain to promote; say sub.domain.com: I set up properly .htaccess file and also added robots.txt file but...

Google still see domain.com/sub/ !

Why this happens? I could forbid the access to that directory via robots.txt file but in that way Google doesn't scan it anymore...

Am I wrong?

Thanks for any useful suggestion

Regards

 

tedster




msg:3417320
 9:35 pm on Aug 8, 2007 (gmt 0)

How about a 301 redirect from the subdirectory addresses to the corresponding subdomain addresses? Also check for any links on your site that use the subdirectory form.

g1smd




msg:3417338
 9:59 pm on Aug 8, 2007 (gmt 0)

That indexed URL is only one of many possible alternatives, as recently discussed in: [webmasterworld.com...]

You'll need that redirect.

specter




msg:3417794
 12:08 pm on Aug 9, 2007 (gmt 0)

Ok.

here is my .htaccess file; I added the redir command (bolded text) as below:

# -FrontPage-

IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti*

Order deny,allow
<Limit GET POST>
Allow from all
</Limit>

<Limit PUT DELETE>
Deny from all
</Limit>

AuthName www.domain.net
AuthUserFile /home/user/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/user/public_html/_vti_pvt/service.grp
AddType application/x-httpd-cgi .htm

redirect permanent /sub [sub.domain.net...]

Options -Indexes +FollowSymLinks
RewriteEngine on

# Redirect all non-canonical domain requests to requested resource in canonical domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.domain\.net
RewriteCond %{HTTP_HOST}!^sub\.domain\.net

RewriteRule (.*) [domain.net...] [R=301,L]

It works fine, but as I never managed such a problem before,I'm not sure is a technically correct solution:

What do you think about?

g1smd




msg:3418016
 4:09 pm on Aug 9, 2007 (gmt 0)

I would use a rewrite with [R=301,L] and check that you do not produce a double redirect for any format of starting URL.

.

For instance, what happens if the site has canonicalisation of index files in place, and you then ask for the index file in that folder?

You would have a redirect to take care of the index file, and another redirect to take care of the folder itself. One redirect runs, and then the other one. That is a redirection chain and is something to be avoided. The redirect should really solve both problems in just one move.

specter




msg:3418163
 6:20 pm on Aug 9, 2007 (gmt 0)

So, how to integrate that 301?
I already tried up adding a previous line such as

RewriteRule (.*) [sub.domain.net...] [R=301,R]

RewriteRule (.*) [domain.net...] [R=301,L]

but it doesn't work.It's the reason for wich I set up that redorect permanent code.

I don't know much about rewrite rules...

tedster




msg:3418190
 6:50 pm on Aug 9, 2007 (gmt 0)

Because people use different servers, the best place for a technical discussion like this is the Apache Web Server forum [webmasterworld.com] (or for others, the Microsft IIS Web Server forum [webmasterworld.com]).

Robert Charlton




msg:3419247
 8:15 pm on Aug 10, 2007 (gmt 0)

I'm not seeing any mention made of the DNS setup.

To "publish" a subdomain, as I understand it, you need either to have set up wildcard DNS or to specify a specific subdomain in your A-records. Your .htacess then might come into play, depending on your preferences and how your subdomains are set up.

What's being done on the DNS now?

jd01




msg:3419263
 8:25 pm on Aug 10, 2007 (gmt 0)

Sorry to be technical out here, but:

### BELOW IS MOD_ALIAS (Redirect permanent) ###
redirect permanent /sub http://sub.domain.net

Options -Indexes +FollowSymLinks

### BELOW IS MOD_REWRITE (RewriteRule) ###
RewriteEngine on

# Redirect all non-canonical domain requests to requested resource in canonical domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain\.net
RewriteCond %{HTTP_HOST} !^sub\.domain\.net

RewriteRule (.*) http://www.domain.net/$1 [R=301,L]

Mod_Alias and Mod_Rewrite directives will be processed in different orders, depending on server configuration, not on rule order. So, it is entirely possible there is a processing order issue.

I would recommend changing everything to Mod_Rewrite and making things a little more efficient:

Options -Indexes +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www¦sub\.domain\.net)?$
RewriteRule (.*) http://www.domain.net/$1 [R=301,L]

RewriteRule ^sub/(.*) http://sub.domain.net/$1 [R=301,L]

For more details see the Apache Forum...
Justin

SixTimesEight




msg:3419348
 9:59 pm on Aug 10, 2007 (gmt 0)

Is the domain in question by chance an addon domain on a cPanel shared hosting account?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google SEO News and Discussion
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved