.htaccess Q -- redirect subdomain page to main domain page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gwidomains
    Confirmed User
    • May 2007
    • 426

    #1

    .htaccess Q -- redirect subdomain page to main domain page

    How do I use .htaccess 301 redirect to

    Redirect a subdomain page to main domain page?

    I have a bunch of pages on sub-domain page i need to redirect individually to different pages.

  • spacedog
    Yes that IS me. Bitch.
    • Nov 2001
    • 14149

    #2
    Code:
    RewriteCond %{HTTP_HOST} !^sub\.domain\.com
    RewriteRule (.*) http://domain.com/$1 [R=301,L]

    Comment

    • gwidomains
      Confirmed User
      • May 2007
      • 426

      #3
      Originally posted by spacedog
      Code:
      RewriteCond %{HTTP_HOST} !^sub\.domain\.com
      RewriteRule (.*) http://domain.com/$1 [R=301,L]
      i think that is for all pages on the sub domain though. I need to assign them individually... that's the problem :/

      thx for the attempt though spacedog.

      Comment

      • SmokeyTheBear
        ►SouthOfHeaven
        • Jun 2004
        • 28609

        #4
        RewriteEngine on
        RewriteCond %{HTTP_HOST} !^www\.domain\.com
        RewriteCond %{HTTP_HOST} ([^*]+)\.domain\.com [NC]
        RewriteRule ^(.*)$ script.php?x=%1 [NC]

        where %1 will be everything before .domain.com

        so if its one.two.three.domain.com it will go to domain.com/script.php?x=one.two.three
        hatisblack at yahoo.com

        Comment

        • fris
          Too lazy to set a custom title
          • Aug 2002
          • 55679

          #5
          horrible examples :p
          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

          Comment

          • gwidomains
            Confirmed User
            • May 2007
            • 426

            #6
            Originally posted by fris
            horrible examples :p

            Comment

            Working...