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 not working

Discussion in 'General Discussion' started by host4profit, Mar 18, 2011.

  1. host4profit

    host4profit Member

    Joined:
    Feb 12, 2009
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    51
    Hello,

    We recently started having the following issue with mod_rewrite. If a client uses the IfModule statement to check on mod_rewrite, it is not found and that part of the code ignored. Example from a Wordpress installation:

    .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    A standard Wordpress Permalinks structure. But, this code is bypassed, pages return a 404 error.

    But, if I change the code as follows:

    #<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    #</IfModule>

    ie: commented out the IfModule statements, then mod_rewrite works correctly.

    We upgraded the server to Cpanel 11.28.86 recently, I can't confirm if this is directly related to this upgrade or not (I don't believe it is though).

    Server Version: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.13

    It's causing a lot of havoc for our clients as their mod_rewrite rules are not working. Any ideas to point me in the right directory would be greatly appreciated!

    Thanks,
    David
     
  2. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    5
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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