Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 09-01-2011, 02:46 AM   #1
HyperActive Warrior
 
Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
Default Help! Redirect subdomain to domain

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]
jo4acause is offline   Reply With Quote
Old 09-02-2011, 08:25 PM   #2
HyperActive Warrior
 
Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
Default Re: Help! Redirect subdomain to domain

Anyone warrior out there who can help?
jo4acause is offline   Reply With Quote
Old 09-02-2011, 08:35 PM   #3
HyperActive Warrior
War Room Member
 
patrich's Avatar
 
Join Date: Nov 2009
Posts: 283
Thanks: 19
Thanked 97 Times in 62 Posts
Default Re: Help! Redirect subdomain to domain

Try this:

Code:
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^mail.mysite.com$ [NC]  
RewriteRule ^/?(.*)$ http://www.mysite.com/$1 [R=301,L]
Make sure you change the "mysite" to your actual domain name. It should work for you.


patrich is offline   Reply With Quote
Old 09-02-2011, 08:37 PM   #4
HyperActive Warrior
War Room Member
 
patrich's Avatar
 
Join Date: Nov 2009
Posts: 283
Thanks: 19
Thanked 97 Times in 62 Posts
Default Re: Help! Redirect subdomain to domain

Btw, that code needs to go in the .htaccess file on your server.


patrich is offline   Reply With Quote
Old 09-03-2011, 07:17 PM   #5
HyperActive Warrior
 
Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
Default Re: Help! Redirect subdomain to domain

Thanks Patrich, appreciate your help.

I will add this code and update.
jo4acause is offline   Reply With Quote
Old 09-04-2011, 04:06 AM   #6
HyperActive Warrior
 
Join Date: Jan 2010
Posts: 168
Thanks: 5
Thanked 3 Times in 3 Posts
Default Re: Help! Redirect subdomain to domain

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]
jo4acause is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum

Tags
domain, redirect, subdomain

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 01:15 PM.