HEEEEEEEELP!

Using a single web hosting account to host multiple sites

HEEEEEEEELP!

Postby George » Fri Jul 28, 2006 9:19 am

I have this subdomain:
states.domain.com
in this subdomain I have folders for the states:
states.domain.com/StateName

IN these folders I have a php file with querystring

I want to redirect all of it to:
www.domain.com/search/StateName/

Can't get it right so I need help!!
George
 
Posts: 9
Joined: Wed Jun 21, 2006 4:30 am

Postby richardk » Fri Jul 28, 2006 9:27 am

Different servers for the domain and subdomain?
Different document roots for the domain and subdomain?

You could probably do it with Redirect. In a .htaccess file in the document root of states.domain.com:
Code: Select all
Redirect 301 / http://www.domain.com/search/
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Same server

Postby George » Fri Jul 28, 2006 9:29 am

I tried that but it won't work the way I need it to.

Here's what I have right now:
RewriteEngine On

RewriteCond %{HTTP_HOST} \.([^\.]+\.[^\.0-9]+\.[^\.]+)$
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteRule ^(.*)$ http://www.%1/search/$1 [R=301,L]

but when I have
http://states.domain.com/california/ it rewrites it just to:
http://www.domain.com/search/
George
 
Posts: 9
Joined: Wed Jun 21, 2006 4:30 am

Postby richardk » Fri Jul 28, 2006 9:50 am

Different servers for the domain and subdomain?
Different document roots for the domain and subdomain?

...

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^states\.domain\.com$ [NC]
RewriteRule !^robots\.txt$ http://www.domain.com/search%{REQUEST_URI} [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

almost....

Postby George » Fri Jul 28, 2006 10:05 am

George
 
Posts: 9
Joined: Wed Jun 21, 2006 4:30 am

Postby richardk » Fri Jul 28, 2006 10:12 am

That's what it does. Your browser has probably cached the 301 redirect, clear your browsers cache.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Tried on 3 different computers

Postby George » Fri Jul 28, 2006 10:34 am

and it only goes to:
http://www.domain.com/search/ and not the /alabama/ part
George
 
Posts: 9
Joined: Wed Jun 21, 2006 4:30 am

Postby richardk » Fri Jul 28, 2006 3:12 pm

Did you clear your browsers cache? It's worked fine every time i've tried it.

Have you got a link?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Thanks!

Postby George » Fri Jul 28, 2006 5:19 pm

Forgot I had a .htaccess in each folder :(
Still, what I am seeing in cPanel/lastVisitors is that when google accesses the file the path is not right and I don't understand why
George
 
Posts: 9
Joined: Wed Jun 21, 2006 4:30 am

Postby richardk » Sat Jul 29, 2006 4:59 am

What happens when you go there? Does it work?

If it works when you go there, there's no reason why it wouldn't work when a bot goes there, mod_rewrite acts no differently.

what I am seeing in cPanel/lastVisitors is that when google accesses the file the path is not right

Has google actually accessed your site since you added the latest mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 35 guests

cron