Mod rewrite help

Discussion in 'PHP' started by happyharry, Aug 25, 2009.

  1. #1
    happyharry, Aug 25, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In an .htaccess file you can do this

    
    RewriteEngine on
    Options FollowSymlinks
    
    RewriteCond %{http_host} ^ageedesign.com [NC]
    RewriteRule ^(.*)$ http://www.ageedesign.com/$1 [L,R=301]
    
    Code (markup):
    Basically it checks to see if host is simply domain.com, if it is, it goes to www. instead
     
    kblessinggr, Aug 25, 2009 IP
  3. Sudoku-Master

    Sudoku-Master Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    so you have only a redirection if the host is domain.com, but no reddirection for ww.domain.com or other subdomains...

    alternativly you can use this rewrite

    
    RewriteEngine on
    Options FollowSymlinks
    
    RewriteCond %{http_host} !^www\.domain\.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    
    Code (markup):
    then will be redirectet if the requestet host is not www.domain.com...
     
    Sudoku-Master, Aug 25, 2009 IP