Jump to content

why don't these work when together


Exoon

Recommended Posts

Hello, ive got these two rules and they work fine when there on their own but as soon as i put them together only the one at the top works. How can i have both these rules?

 

RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&id=$2& [L,NC]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&console=$2& [L,NC]

Link to comment
Share on other sites

the difference is one is using id and one is using console.

 

I want it so its like

 

index.php?page=reviews&id=7    goes to >>    /reviews/7/

index.php?page=games-list&console=ps3    goes to >>  /games-list/ps3/

 

but only one of them works. How can i get both working?

Link to comment
Share on other sites

that isn't how it works though, it's the other way around:

 

/reviews/7/    goes to >>    index.php?page=reviews&id=7

/games-list/ps3/    goes to >>  index.php?page=games-list&console=ps3

 

that being said, both the first and second examples will match the first REGEX. i would switch it to something more generic, like this:

 

RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&topic=$2& [L,NC]

then adjust your reviews code to map $_GET['topic'] to the id and your games-list code to map $_GET['topic'] to the console

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.