i need help with mod rewrite

Discussion in 'Programming' started by feelexit, Jul 17, 2007.

  1. #1
    my domain name is www.johnqin.com

    if visitors typed

    johnqin.com/about.html

    I want to change it to www.johqin.com/about.html using mod rewrite. I just want to make sure it starts with 'www.'

    how to write this Rule, and should I place it at the beginning of the .htaccess file or the end of .htaccess file.
     
    feelexit, Jul 17, 2007 IP
  2. DecisionsIN

    DecisionsIN Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Place this into your .htaccess file. Be sure the first two items appear at the top.

    Options +FollowSymLinks

    RewriteEngine On

    # Force www.
    RewriteCond %{HTTP_HOST} ^(johnqin\.com)$ [NC]
    RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
     
    DecisionsIN, Jul 17, 2007 IP