Support » Fixing WordPress » Weird htaccess/mod_rewrite problem

  • I’m running WP 1.0.1 Miles and I wanted to switch to nice URI’s using the .htaccess/mod_rewrite option.
    So I set everything up in the admin-section and copied the code into my .htaccess file, in the root of my WP directory, BUT after I did that, I get a 403 Forbidden You don’t have permission to access / on this server message on whatever page I try to view. Mod_rewrite is enabled on my host’s server.
    My .htaccess contents:
    # this will make register globals off in wp's directory
    # just put a '#' sign before these three lines if you don't want that

    <IfModule mod_php4.c>
    php_flag register_globals off
    </IfModule>

    # this will set the error_reporting level to remove 'Notices'
    <IfModule mod_php4.c>
    php_value error_reporting 247
    </IfModule>

    # This activates content negotiation, so instead of /archives.php you could just call
    # a file as /archives . Same for any other file on your site. Try it out!

    Options +Multiviews
    RewriteEngine On
    RewriteBase /
    RewriteRule ^archives/([0-9]{4})?/?([0-9]{1,2})?/?([0-9]{1,2})?/?([0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA]
    RewriteRule ^archives/category/?(.*) /index.php?category_name=$1 [QSA]

    Any ideas?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Umm… first thing I always try when doing this is replacing [QSA] with [R=permanent] just so I know where it’s trying to redirect to… that way you can see what’s wrong with your rewrite rule by where it’s trying to redirect you.

    I had the same problem. My Apache error log said
    Permission denied: /home/<user>/<path>/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
    The error occured whether there was a .htaccess file in the directory or not. The error went away once I made the directory writeable for the web server process. Try
    Chmod 777 <wordpress directory>

    You might also try a .htaccess with only the code generated by the permalinks page, and see if that works (looks like you used the example.htaccess as the base for your .htaccess.)

    Chmod 777 ???
    That translates to “oh, please, please, please 0wn my server, mister script kiddie”

    Not really… still have to get an account that has some kind of access to that directory.

    I have a similar problem. With no .htaccess, all is well. With the usual .htaccess I use to set 1 year expire dates on image files, all is well. When I use the code wordpress spits out for my htaccess file, I receive a 403 error, whether the code is alone or accompanied with my other htaccess stuff.
    I tried antifuse’s R=permanent suggestion, it did not help.
    I’m not going to chmod 777 anything. You should never have to do that. If there’s a legitimate chmod needed for the server to do something it can’t by default, fine, but everyone-everything is not an appropriate suggestion.
    I’m running on a redhat box using the ensim system, I don’t recall any of the versions offhand but they’re all fairly recent (php 4.2 or higher IIRC).
    The site is running under a subdirectory called ‘weblog’ and I was trying to set my ‘pretty’ links to something like /old/2003-12-31/this_is_a_test
    Does anyone have any ideas?

    I had this problem once…. when trying to use mod_rewrite on a Windows server….. a shot in the dark, but what is the server running? Is it Linux/Unix or Windows?
    TG

    Redhat is Linux.

    yeah, it’s linux.
    And I checked in phpinfo(); and it says mod_rewrite is installed.
    Anyone have any ideas?

    Not working for me either, and I know the mod_rewrite works because I used it for PostNuke on the same server

    place this line at the begining of your .htaccess
    Options FollowSymLinks
    worked for me 🙂

    Well you need to make sure that your first line has no break.
    This:
    RewriteRule
    ^archives/….yada yada yada
    Should be this:
    RewriteRule ^archives/….yada yada yada
    Make sure there are no carriage returns or breaks in your rewrite rules, doing that fixed all my problems.

    chmod 755 httpdocs and it started working for me

    thanks kristin! that works for me.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Weird htaccess/mod_rewrite problem’ is closed to new replies.