Good day everyone. I've been having this problem with my Wordpress websites and I hope you guys can help me.
Currently I have a domain xyz.com
and I created a subdomain abc.xyz.com
. I installed Wordpress for both sites via my hosting cpanel and started to design my subdomain site and everything worked fine. But now I realize that I can only access my subdomain through the Wordpress dashboard in my hosting cpanel. If I try to type abc.xyz.com
it will auto redirect to my main domain xyz.com
, which is empty.
I have no idea what caused this. Any suggestion on how to stop my subdomain auto-redirecting to the root domain? Here is my .htaccess
look like if it's gonna help:
# BEGIN LSCACHE
# END LSCACHE
# BEGIN NON_LSCACHE
# END NON_LSCACHE
# BEGIN WordPress
# redirect to https www
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 weeks"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
CodePudding user response:
This could be related to your Database and home URLs. Are you sure everything is set to point to your subdomain instead of the main one?
CodePudding user response:
I'm having the exact same issue. I checked the htaccess just as Hai Anh Ngo and this is the same:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Then I checked the database and the site url and home are pointing to the subdomain, so I too really don't know why when I try to access the subdomain it redirects to the main domain.