WordPress.org

Forums

Clean URLs and .htaccess (2 posts)

  1. nrutman
    Member
    Posted 7 years ago #

    Hello. I'm trying to get clean urls to work with my installation of WordPress.

    My permalink structure is:

    /%year%/%monthnum%/%day%/%postname%/

    My .htaccess file contains:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ /index.php/$1 [L,QSA]

    And it works great for articles. The problem is that when I try to access archives, categories or tags (myurl.com/category/the_category), it generates a 404 error, since it's interfering with the article redirect. Pages seem to work fine though. How do I tell mod_rewrite NOT to rewrite the URL if it's a category, tag or archive link? I can't seem to find any documentation or web page clearly documenting how to do this...

    Thanks!
    -Nate

  2. whooami
    Member
    Posted 7 years ago #

    thats what ! is for :)

    for instance,

    RewriteCond %{REMOTE_ADDR} =24.175.114.15
    RewriteCond %{REQUEST_URI} !/idiot\.php$
    RewriteRule \.php$ http://www.village-idiot.org/idiot.php [R=301,L]

    will apply the rewrite rule to every page except idiot.php

    its used in the example above to prevent looping.

Topic Closed

This topic has been closed to new replies.

About this Topic