![]() | | ||||||||
| | #1 |
| HyperActive Warrior Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
|
Hello There I need help with htaccess redirection code. I want to redirect all mail.domain.com/blog (and all internal pages) to www.domain.com/blog. also mail.domain.com/gift (and all internal pages) to www.domain.com/gift. I currently have a redirection code which is only redirecting mail.domain.com to www.domain.com. But this is not redirecting some of my subpages like the ones above. mail subdomain is a virtual domain created by cpanel, so i cannot insert any codes in the root of the subdomain. Help will be much appreciated. Thanks === current code used RewriteEngine on RewriteCond %{http_host} !^www.example.com$ [nc] RewriteRule ^(.*)$ IANA — Example domains [r=301,nc,L] |
| | |
| | #2 |
| HyperActive Warrior Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
|
Anyone warrior out there who can help?
|
| | |
| | #3 |
| HyperActive Warrior War Room Member Join Date: Nov 2009
Posts: 283
Thanks: 19
Thanked 97 Times in 62 Posts
|
Try this: Code: RewriteEngine on
RewriteCond %{HTTP_HOST} ^mail.mysite.com$ [NC]
RewriteRule ^/?(.*)$ http://www.mysite.com/$1 [R=301,L] |
| | |
| | |
| | #4 |
| HyperActive Warrior War Room Member Join Date: Nov 2009
Posts: 283
Thanks: 19
Thanked 97 Times in 62 Posts
|
Btw, that code needs to go in the .htaccess file on your server.
|
| | |
| | |
| | #5 |
| HyperActive Warrior Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
|
Thanks Patrich, appreciate your help. I will add this code and update. |
| | |
| | #6 |
| HyperActive Warrior Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
|
I added it to my root domain but doesn't work. Because mail subdomain is a virtual subdomain created by cpanel there is no option to add it to the root of the subdomain. This is how the current Htacess redirection codes are set up. ====== Options +FollowSymlinks RewriteEngine on RewriteCond %{http_host} !^www.exampple.com$ [nc] RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc,L] RewriteCond %{HTTP_HOST} ^mail.example.com$ [NC] RewriteRule ^/?(.*)$ http://www.example.com/$1 [R=301,L] |
| | |
![]() |
|
| Tags |
| domain, redirect, subdomain |
| Thread Tools | |
| |
![]() |