Subdomain redirects to Main Domain


#1

Hey i have a domain hosted on dreamhost with a subdomain everything was working perfect and great. but today i face this issue whenever i am trying to open my subdomain its redirect to the main domain.
Like:
Main domain: www.maindomain.com
Sub domain: test.maindomain.com

I have different htaccess files for the both site separately. I tried every code every solution which i found online but nothing work.

Please help to resolve my issue.

Thanks


#2

What htaccess are you using on the sub-domain?

Most of us are just customers like you. You have to provide all the details because we can’t access your account.


#3

Thank you so much for your reply here is .htaccess file

BEGIN WordPress

RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

END WordPress

# Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml

Remove browser bugs (only needed for really old browsers)

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

EXPIRES HEADER CACHING

ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 2 days" ## EXPIRES HEADER CACHING ##

#4

thanks you very much


#5

I’m no htaccess expert, but I don’t see the normal pitfalls to unexpected redirection in this one. However if you temporarily rename it does the re-direction continue?


#6

Did you figure this out?

I’m having the same issue. Subdomain worked fine for years, and is now suddenly redirecting to the main domain. I tried temporarily renaming the .htaccess file, with no change in the results. Haven’t head back from support yet. Starting to freak since my company’s voicemail system is on that subdomain (using DreamHost’s one-click install of OpenVBX).

Thanks for your time!


#7

Hi TazG sorry to hear of your issues. It’s hard to give you any suggestions from the forum if you don’t tell us what your domains are :frowning: Did you change anything before the issue started? Did you check both .htaccess files in domain and subdomain? What do you see in the access and error logs in both domains folders?

Let us know what your debugging efforts produce and maybe we’ll be able to give you more precise suggestions.


#8

Good news! I was able to get the issue resolved by “chatting” with an online tech. It turns out the directory for the subdomain had somehow been reset to match the directory of the master domain. All I had to do was put the correct directory back in, and things returned to normal. I hate that it suddenly changed on its own, but at least it was an easy fix!