Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

mod_rewrite directives seem to be ignored

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

  1. idealso

    idealso Active Member

    Mar 1, 2007
    Likes Received:
    Trophy Points:
    I am trying to set up a canonical hostname, as describe in the second entry in However, it is not working. Using as an example, where it should be, if I go to 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 ^/(.*)$1 [L,R]

    I also added:

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^/(.*)$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?

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice