how to redirect domain/folder to subdomain to non-www in cpanel not working ?
hi,
I am using cPanel 84.08 VPS cloud - CentOS 7.7 MariaDB 10.3
I am having an issue with subdomain redirects
so I have a domain called: example.com
I have this set to https:// and to redirect to www.example.com working great...
I then create a sub domain: work.example.com
i then turn on https:// then go to redirects and try to redirect the subdomain without www. but it throws error, because it is the same path / Folder
so then I go back to redirect and select : example.com
then I add the folder /work
then I add but it doesn't redirect
so i select: redirect with or without www
and that seems to work but, the only issue is that I can type http://www,work.example.com and it doesn't redirect to to redirect to or
to redirect to
-
Hello @Spirogg I'm not able to replicate this. - I have a subdomain called 123.mydomain.us
- Its document root is in /home/myuser/public_html/123
- the root domain mydomain.us is forced to redirect to https
- When I add a redirect through cPanel the following is added to the .htaccess for the subdomain:
RewriteCond %{HTTP_HOST} ^123\.mydomain\.us$ [OR]RewriteCond %{HTTP_HOST} ^www\.123\.mydomain\.us$ RewriteRule ^/?$ "https\:\/\/mydomain\.us\/" [R=301,L]
- I tested by entering in the following:
- All of them redirected successfully to mydomain.us - Domain Names Resources and Information.
0 -
Hi @cPanelLauren I did clear cache. And still have this issue. So my setup is different. So maybe I can explain a little more. I have setup work.domain.us have enabled to force https:// But I want to make sure that whom ever goes to www.domain.us/work or domain.us/work will be redirected to 0 -
Hello, In my instance I forced https on the destination domain only - since anything else is being redirected to it. I realize it didn't show very visibly on the link. What's the redirect look like in the .htaccess file? 0 -
First I have forced https for both domain.com and work.domain.com Then I redirected domain.com to Here is the code below. RewriteCond %{HTTP_HOST} ^domain\.com$ RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/" [R=301,L] RewriteCond %{HTTP_HOST} ^domain\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.domain\.com$ RewriteRule ^work\/?$ "http\:\/\/work\.domain\.com\/" [R=301,L]
I think this is working now except if someone enters Which I don't think anyone will type www.work.domain.com from a css and login stand point. Has to be one or the other either0 -
Hi @Spirogg But the end goal is for them to end up at with or without https and with or without www RewriteCond %{HTTP_HOST} ^123\.mydomain\.us$ [OR] RewriteCond %{HTTP_HOST} ^www\.123\.mydomain\.us$ RewriteRule ^/?$ "https\:\/\/mydomain\.us\/" [R=301,L]0 -
Ok this worked awesome your the BEST !!!!! THANKS SO MUCH I was breaking my head trying to figure it out. Thanks Solved Regards, Spiro 0 -
I'm so glad that worked! Thanks for letting me know too :) 0
Please sign in to leave a comment.
Comments
7 comments