I'm having an issue getting redirection to work, I've tried every method that I know.
What I'm trying to do:
I have www.domainname.com
, and subdomain.domainname.com.
I need to make subdomain.domainname.com redirect to subdomain.domainname.com, our client no longer uses the subdomain anymore.
I only have access to cPanel on the web host, I can't access any information on the registrar's side, and don't even know who the domain is registered with.
What I have done:
- In cPanel, it says that the document_root for the subdomain is in "public_html/subdomain/" directory, so I put a 301 Permanent Redirect rule in the .htaccess file of the subdomain/ directory_root. (and before anyone asks, yes, .htaccess is enabled and works, we are using it elsewhere on this site.)
*One other thing to note about this, the contents of the subdomain's directory root are not what show up when I browse to the page. So the reason for the .htaccess not working, I speculate that it is because the subdomain is not going to it's specified document_root.
- Next thing I tried: I set up cPanel's built-in redirection from the "Subdomains" section of cPanel. Unfortunately that did not work either.
- The last thing that I tried was: I set up a CNAME record in the DNS for subdomain.domainname.com to go to www.domainname.com
*One thing that I should note about this is that when I ping subdomain.domainname.com and www.domainname.com
, I get two very different IP addresses returned.
I know that It would be easier for you to actually see what the problems are by visiting the actual domains, but in the interest of our client's privacy, I am unable to disclose the domains or IP addresses.