Jump to content

Multiple RewriteRule's seem to be Conflicting


ncovill

Recommended Posts

Hey all,

For some reason a few of my RewriteRule's seem to be conflicting with one another.

I have several rules, but these are the conflicting ones:

 

RewriteRule ^([a-zA-Z0-9_-]+)/page=([0-9_-]*)$ /pages.php?cat_id=$1&currentpage=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)$ /pages.php?cat_id=$1 [L]

 

The rule above works fine (i can go to /category fine, it goes to the proper page and everything).

 

But once I add in:

RewriteRule ^([a-zA-Z0-9_-]+)$ /index.php?order=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/page=([0-9_-]+)$ /index.php?order=$1&currentpage=$2 [L]

 

The first part stops working (the pages.php rule), but these new rules work fine (the ?order= rules)...

The ?order= rules are above the pages.php rule in my .htaccess file, but when I put the order rule below the pages.php rule, then the categories rule works fine, while the order rule no longer does... so confused :/

 

As always, any kind of help is appreciated!

Link to comment
Share on other sites

Two scripts can't have the same URLs. You need to give them something unique in the URL, like

 

RewriteRule ^page/([a-zA-Z0-9_-]+)/page=([0-9_-]*)$ /pages.php?cat_id=$1&currentpage=$2 [L]

RewriteRule ^index/([a-zA-Z0-9_-]+)/page=([0-9_-]+)$ /index.php?order=$1&currentpage=$2 [L]

 

RewriteRule ^page/([a-zA-Z0-9_-]+)$ /pages.php?cat_id=$1 [L]

RewriteRule ^page/([a-zA-Z0-9_-]+)$ /index.php?order=$1 [L]

 

and I would suggest also changing

 

/page=

 

to

 

/page/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.