• I’m having a weird mod_rewrite problem. I’ve enabled permalinks (mod_rewrite) and it is working for every page except for index.php.

    Working link: http://www.poundbangwhack.com/about

    Nonworking link: http://www.poundbangwhack.com

    .htaccess file:

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

    Excerpt from httpd.conf file:

    <Directory />
         Options FollowSymLinks
         AllowOverride All
      </Directory>

    Excerpt from httpd error logs:

    Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/poundbangwhack.com/httpdocs/

    The strangeness is that the server only throws the 403 forbidden error on the index.php page. I have a feeling this may not be necessarily a WordPress related issue, but it is where I cam currently experiencing the problem and need this to work.

    Before people point out the obvious, I have been all over the internet searching for this. As you can see above, the .htaccess is setup correctly and I have enabled the ‘Options FollowSymLinks’ in my httpd.conf file. Permissions are also set correctly as well. I work in the server support department of a major internet hosting provider and hate asking for help, but I have literally checked everything I can think of and tried multiple “fixes” found online, all with no luck. Please don’t answer with ‘the usual suspects’ type of fixes as I have gone through them all. I’m hoping someone else has had this problem before and can provide a solution. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • try forcing a rewrite
    delete the .htaccess entirely
    access site – does it work now?
    reset permalinks

    Thread Starter desertwebdesigns

    (@desertwebdesigns)

    @samboll
    Same thing. I had tried a couple times changing permalinks, renaming .htaccess, etc. I deleted it, and the index page worked, but of course the permalinks didn’t (no mod_rewrite). Saved permalinks configuration and back to the same issue: permalinks work, index doesn’t

    I have never seen that to be honest – hopefully someone has

    Thread Starter desertwebdesigns

    (@desertwebdesigns)

    @samboll: Thanks for looking into it.

    Follow-up:
    I enabled RewriteLog and set it to Level 9. The rewrite rules are processing properly. For instance, the ‘about’ page meets the ‘!-f’ and ‘!-d’ criteria so it redirects to ‘/index.php’. The ‘index.php’ file does not meet the ‘!-f’ so it allows to pass through and loads ok. I also tested another file I have on the server ‘linux.php’ and it was allowed to pass through as well because it failed the ‘!-f’ condition.

    However, when accessing the root domain ‘http://www.poundbangwhack.com/&#8217; it does not trigger the mod_rewrite and nothing is logged. It should trigger the rewrite rules and allow it to just pass through, but it does not even check the request against the rewrite rules. If I access it with the index.php added ‘http://www.poundbangwhack.com/index.php&#8217;, it triggers the mod_rewrite and does not match the ‘!-f’ rule and allows to pass through succesfully. Yet I still end up with the 403 forbidden and it logs the error mentioned in my original post.

    It looks like it is trying to call mod_rewrite on the root directory when it shouldn’t be. That’s why I get a 403 forbidden. Because of the way WordPress is configured, when accessed with the index.php, it will automatically redirect to my site url, thus triggering the forbidden mod_rewrite error.

    I kind of knew all that, but was able to verify that is what is happening with the help of ‘RewriteLog’. Like I said, not a wordpress issue, but that’s where it’s giving me a headache currently.

    Thread Starter desertwebdesigns

    (@desertwebdesigns)

    So I got this resolved. I have NO idea what caused it. Instead, I backed everything up and reprovisioned my server. It was obviously either an Apache or mod_rewrite error and I’m not sure what specifically. But the reprovision and fresh install of both got it working.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Weird mod_rewrite problem’ is closed to new replies.