Welcome to WebmasterWorld Guest from 23.22.140.143

Message Too Old, No Replies

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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 1, 2005
posts:741
votes: 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

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

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 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.
9:59 pm on Aug 8, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


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

You'll need that redirect.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 1, 2005
posts:741
votes: 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?

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

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 1, 2005
posts:741
votes: 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...

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

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 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]).
8:15 pm on Aug 10, 2007 (gmt 0)

Moderator This Forum from US 

WebmasterWorld Administrator robert_charlton is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 11, 2000
posts:11314
votes: 165


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?

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 9, 2005
posts:1509
votes: 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

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

Junior Member

5+ Year Member

joined:June 20, 2007
posts:42
votes: 0


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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members