I created a subdomain in cPanel and set it to redirect to the www version of my site. The redirecting works insofar as redirecting subdomain.example.com
to www.example.com
.
But when a visitor tries to go to subdomain.example.com/file1
, he is taken to a 404 page instead of www.example.com/file1
.
How do I fix this?
Edit: This is the .htaccess that cPanel has created in the subdomain's directory (which btw is just public_html\subdomain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.subdomain\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]