subdomain not working

laguna

New Member
Hello, I really need some input. I transferred a site last night, one that had two subdomains. Everything was coming up fine. Today, one of the subdomains is redirecting to a folder under the main directory. The other one is not. I tried removing it through cpanel. That, oddly enough, did not remove the files. So I removed the files via ftp. Then I created the subdomain again. Still has the same redirect issue.

My other subdomain works fine. I can access it as subdomain.domain.com. But the second subdomain redirects automatically from subdomain.domain.com to domain.com/subdomain.

My .htaccess is below. This .htaccess has worked fine for a year on another server. And my other subdomain works fine on this server (both on the same domain). So I don't believe it is a .htaccess problem like tech support suggests. Anyone have any ideas what else it could be?


Code:
#Redirect direct client requests for /index.php or /index.shtml in 
# any subdirectory back to [URL="http://www.example.com/"]www.example.com/[/URL] 
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteRule ^(.+/)?index\.(php|shtml)$ [URL]http://www.example.com/[/URL] [R=301,L] 
#
# Redirect direct client requests for /subdir/ back to [URL="http://www.example.com/"]www.example.com/[/URL] 
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteRule ^subdir(/(.*))?$ [URL]http://www.example.com/$2[/URL] [R=301,L] 
# 
# Redirect non-canonical hostname to canonical host 
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] 
RewriteRule ^(.*)$ [URL]http://www.example.com/$1[/URL] [R=301,L] 
#
# Rewrite Web root directory requests to /subdir 
RewriteRule !^subdir(/.*)?$ /subdir%{REQUEST_URI} [QSA,L]


:confused:
 
That is an absolute mess and is doubtlessly conflicting with what cPanel put into your httpd.conf file to manage this subdomain for you. What do you need any of that for?
 
Really?

It comes from some very knowledgeable gurus.

The first simply redirects requests from index.php back to the domain.com. This is done for SEO reasons. See matt at google for more info.

The second simply redirects requests to specific subdirectory back to the main domain. In otherws requests to domain.com/subdir/ would be redirected to domain.com. No one should be making requests for that subdir, but if they did, they would be getting an indentical page as someone who made a request for a page without the subdir. Therefore, for SEO reasons, this must be done.

The third one simply redirects non-www back to www, again for SEO reasons. See matt at google.

The last one simply does an internal rewrite on the subdir so that it is not exposed to the world.

Are you a guru?
 
Clearly not, but my subdomains work.

I'd enable rewrite logs on the virtual host and make sure those regex's are actually doing whatever it is you and Matt at Google think they are.
 
Top