WordPress.org

Support

Support » How-To and Troubleshooting » Help me sort out mod rewrite permalinks?

Help me sort out mod rewrite permalinks?

  • I’ve tried this several times, but can’t seem to get it to work.
    If I set my permalink structure to something like:
    /%year%/%monthnum%/%day%/%postname%/
    and the “you should have this in your .htaccess” box says:
    ‘RewriteEngine On
    RewriteBase /
    RewriteRule ^category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?category_name=$1&feed=$2 [QSA]
    RewriteRule ^category/?(.*) /index.php?category_name=$1 [QSA]
    RewriteRule ^author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?author_name=$1&feed=$2 [QSA]
    RewriteRule ^author/?(.*) /index.php?author_name=$1 [QSA]
    RewriteRule ^([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 ^([0-9]{4})/?([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA]
    RewriteRule ^([0-9]{4})/?([0-9]{1,2})/([0-9]{1,2})/([_0-9a-z-]+)/trackback/?$ /wp-trackback.php?year=$1&monthnum=$2&day=$3&name=$4 [QSA]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1 [QSA]
    RewriteRule ^comments/feed/?([_0-9a-z-]+)?/?$ /wp-feed.php?feed=$1&withcomments=1 [QSA]’
    I just end up getting a “no permissions” when I try to go to my site.
    Mod_rewrite is enabled. Any ideas?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Moderator James Huff

    @macmanx

    And did you add that code into your .htaccess file?

    Sorry, should’ve said . . .”I just end up getting a “no permissions” . .”can’t access /”, when I put that in my .htaccess and go to my site.

    Moderator James Huff

    @macmanx

    Odd. Is your .htaccess file in the same directory as the index.php for your blog. Does the .htaccess file have 666 permissions (chmod 666)?

    Ok, double checked that, then I get.
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    should I need index.php/path/to/whatever ? Or I can do without the index.php?

    Error in the code, fixed it, back to 403.

    Moderator James Huff

    @macmanx

    Do you mean a 403 when you try to access your .htaccess through a browser? If that’s the case, you should. You can edit your .htaccess file either through your computer via FTP (downloading, editing, delete the original off the server, and upload edited file) or through the WordPress templates editing area (assuming that .htaccess has 666 permissions). Sorry I didn’t think of that earlier.

    No. I mean I shell in and edit my .htaccess in Vi. Then I go to the browser and go to http://www.tekmonki.com. 403.
    I chmod 666 .htaccess
    go to http://www.tekmonki.com.
    403.

    Moderator James Huff

    @macmanx

    Ouch, you should probably email your host over that. Something is really wrong on their end.

    Before I do that, any ideas as to what may be the problem? I find it’s helpful if I can say “x is doing y” instead of . . .”this isn’t working’. Things tend to get done faster that way I’ve noticed. = ]

    Moderator James Huff

    @macmanx

    “I have edited my .htaccess file as directed by WordPress, which seems to work for everyone else. However, my site is now giving me 403 errors. Would you mind taking a look at the .htaccess file and telling me what’s wrong?” Or something like that ^_-

    So I’m told that I need to edit my httpd.conf file as it doesn’t work on virtual hosts. So I put the rewrite rules in there and the site mostly works, but clicking on a post gives “page not found”. Any thoughts?

    The problem with putting those rules elsewhere is that the RewriteBase instruction is bound to be read wrong.
    RewriteBase /
    means that all requests will be rewritten with the current directory (Same as that of httpd.conf) as the base. Try changing that to the absolute path of your wp index.php file, or the relative path from the dir containing the httpd.conf to the index.php file.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Help me sort out mod rewrite permalinks?’ is closed to new replies.