WordPress.org

Ready to get started?Download WordPress

Forums

rewrite_rules clobber custom .htaccess...Bug ? (2 posts)

  1. Master_Kato
    Member
    Posted 6 years ago #

    Hi,

    I recently upgraded to WP 2.3, from 1.5 and am having a problem with permalinks.

    In 1.5 WordPress would write all it's rules to .htaccess, but now it saves those in a database.

    At the beginning of my .htaccess I rewrite anything that begins with a page called galleries:

    RewriteRule ^(galleries)/(.*)/?$ /index.php?pagename=$1&page=$2 [L]
    so that I can handle these separately.

    However, since upgradingto 2.5 this hasn't worked. Some of the links just end up redirecting to the top level. What I think is happening is that the rewrite_rules in the database are clobbering my first rewrite in .htaccess. If I turn off permalinks entirely (i.e. no rewrit_rules) then my above RewriteRule in .htaccess works fine, but if I turn on permalinks in WordPress is ceases working for most links.

    Any suggestions?

  2. enposte
    Member
    Posted 6 years ago #

    I have the same problem.

    I use WordPress 2.3.1 as part of a bigger site and have it installed in its own subfolder.

    At the root, I have an .htaccess which does url rewrites for the non-wordpress part of the site.

    The rewrites work great for non-wp, but stop working as soon as I enable wp permalinks.

    The conflict, I think, is caused by the internal wordpress rewrites, because even when I delete the wp .htaccess from the wp subfolder (and leave permalinks enabled), my non-wp rules don't work.

    Now I have disabled the permalinks until I find a solution.

    My non-wp rules are like this:

    # Add Trailing Slash
    RewriteRule ^items/([-a-z0-9]+)$ /items/$1/ [NC,R=301,L]

    # Main Rewrite Rule
    RewriteRule ^items/([-a-z0-9]+)/?$ /index.php?page=items&item=$1 [NC,QSA,L]

    The custom rules are fairly standard stuff, and are kept in their own htaccess at the root. I don't know why wordpress, which is in its own subfolder, interfere with them.

    Appreciate your ideas.

Topic Closed

This topic has been closed to new replies.

About this Topic