The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_rewrite directives seem to be ignored

Discussion in 'General Discussion' started by idealso, Apr 19, 2007.

  1. idealso

    idealso Active Member

    Joined:
    Mar 1, 2007
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    I am trying to set up a canonical hostname, as describe in the second entry in http://httpd.apache.org/docs/1.3/misc/rewriteguide.html. However, it is not working. Using example.com as an example, where it should be www.example.com, if I go to example.com it does not get rewritten. I have the following in a .htaccess:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

    I also added:

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

    But no change.

    I was able to get an error by saying "RewriteEngine fail" but other than that, nothing in the error logs.

    Why does it seem that the rewrite rules are being ignored, and how can I fix this?
     
Loading...

Share This Page