Results 1 to 15 of 15

Redirect from sub-domain

This is a discussion on Redirect from sub-domain within the Link Building forums, part of the vBulletin SEO Discussion category; Hello, someone know how to setup a redirect from subdomain? I need to setup some redirect rules from specific subdomain ...

  1. #1
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times

    Question Redirect from sub-domain

    Hello,

    someone know how to setup a redirect from subdomain? I need to setup some redirect rules from specific subdomain to specific url on a primary domain.
    I am trying to configure it from .htaccess not it doesn't work

    Example:

    Thank you

  2. #2
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    You can use an or condition in your nonwww to www to direct everything but subs you chose.

    Code:
    RewriteCond %{HTTP_HOST} !(^www\.domain\.com$|^subkeep\.domain\.com$)
    RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
    this will direct all non- www requests to www, EXCEPT subkeep, so subkeep.domain.com will load, but badsub.domain.com will direct to www.domain.com

  3. #3
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Hello Brian, with your way Can I setup multiple rules? Because I need to setup not one rule, but about 20/30 redirect rules.

    Thanks

  4. #4
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    The way above is basically a catch-all. The only subdomains you will need to add in (subkeep) are the ones you DONT want to redirect.

  5. #5
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Yes but for each subdomain redirect rule I need to point to specific url, not all the sub-domain to a primary domain.

    Example:

    1) http://aaa.mysite.com point to http://www.mysite.com/alex/aaa/

    2) http://bbb.mysite.com point to http://www.mysite.com/jason/bbb/

    etc...

  6. #6
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    in this case, you will need to do this one by one as 'jason' and 'alex' do not exist in the url.

    Code:
    RewriteCond %{HTTP_HOST} ^aaa\.domain\.com$
    RewriteRule (.*) http://www.domain.com/alex/aaa/ [L,R=301]
    
    RewriteCond %{HTTP_HOST} ^bbb\.domain\.com$
    RewriteRule (.*) http://www.domain.com/jason/bbb/ [L,R=301]
    and so on

  7. #7
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Oh great Brian, I am searching the solutions on all Internet from many days, thank you very much ;-)

  8. #8
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Hello, please I have another question. I must redirect an url as this:

    to

    Now, as this I have also other articles. Is possible set a custom redirect for all? Or must I set each single redirect?
    In this case, can you tell me the right code?

    Thank you

  9. #9
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    untested, but it will be something like this:
    Code:
    RewriteCond %{HTTP_HOST} ^news\.domain\.com$
    RewriteCond %{REQUEST_URI} ([0-9]+)-(.*)
    RewriteRule (.*) http://www.domain.com/$1-$2/ [L,R=301]

  10. #10
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Hello Brian, I tried your code but it doesn't work, this url is redirect to:

    news.mysite.it/245-ancora-proroghe-per-windows-xp/
    to

    Howeaver Brian, please I need of a different rewrite rule because I decided to use the "CMS Entry":

    http://www.mysite.it/entryTITLE-entryID/

    Finally, I need to redirect some articles from subdomains to main domain, like this:

    cms.mysite.it/entryID-entryTITLE/
    news.mysite.it/entryID-entryTITLE/
    etc.
    to final CMS URL's

    Can you help me to find the right code to redirect the url from subdomain?

    Thank you

  11. #11
    vBSEO Staff Brian Cummiskey's Avatar
    Real Name
    Brian Cummiskey
    Join Date
    Jul 2009
    Location
    btwn NYC and Boston
    Posts
    12,789
    Liked
    657 times
    Blog Entries
    2
    RewriteCond %{HTTP_HOST} ^news\.domain\.com$
    RewriteRule (.*) http://www.domain.com/ [L,R=301]

    is about as good as you are going to get. entrytitle-entryID will match just about everything else, includeing threads, so a generic rule is not posisble. You would need to move each article one by one, and for this, you should just list them in the custom redirects portal in vbseoCP.

  12. #12
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    I understand...thank you very much Brian

  13. #13
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Hello Brian, sorry again

    I am trying to set each rule for each articles, but I have an Internal Server Error..can you give me a single correct rule?

    I am trying to redirect:

    programmi.mysite.it/427-winrefine-al-passaggio-del-mouse-mostra-anteprime-mp3-audio-immagini-e-video/

    to

    http://www.mysite.it/winrefine-al-pa...i-e-video-427/

    My rule:

    RewriteCond %{HTTP_HOST} ^programmi\.mysite\.it\427-winrefine-al-passaggio-del-mouse-mostra-anteprime-mp3-audio-immagini-e-video\$
    RewriteRule (.*) http://www.mysite.it/winrefine-al-pa...i-e-video-427/ [L,R=301]

    Thank you Brian!

  14. #14
    Senior Member
    Real Name
    Ceri May
    Join Date
    Jul 2009
    Location
    United Kingdom
    Posts
    1,726
    Liked
    15 times
    Blog Entries
    1
    You need to change that rule to

    RewriteCond %{HTTP_HOST} ^programmi\.mysite\.it
    RewriteRule 427-winrefine-al-passaggio-del-mouse-mostra-anteprime-mp3-audio-immagini-e-video/$ http://www.mysite.it/427-winrefine-a...agini-e-video/ [L,R=301]

  15. #15
    Senior Member
    Real Name
    Jarod
    Join Date
    Oct 2006
    Location
    Italy
    Posts
    184
    Liked
    1 times
    Perfect Ceri, it works well!

    Thank you

Similar Threads

  1. setup SEO friendly redirect from new domain to old domain
    By vitrag24 in forum General Discussion
    Replies: 3
    Last Post: 04-25-2010, 08:11 PM
  2. Replies: 4
    Last Post: 11-04-2009, 06:07 PM
  3. 301 Redirect from Domain Folder to Domain
    By MadCaffeine in forum General Discussion
    Replies: 1
    Last Post: 05-20-2008, 05:28 PM
  4. Redirect parked domain to primary domain
    By Arkidas in forum General Discussion
    Replies: 9
    Last Post: 03-20-2008, 06:19 PM
  5. redirect domain.com/index.php to www.domain.com/
    By LarryEitel in forum Custom Rewrite Rules
    Replies: 4
    Last Post: 07-05-2006, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •