Jump to content

mod_rewrite simalar rules how?


olli460

Recommended Posts

Hi,

 

Im new to using mod_rewrite. Ive got two simalar rules and i can't get them both working, Only the one that is above the other one works.

 

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

 

 

What can i do?

Link to comment
https://forums.phpfreaks.com/topic/174976-mod_rewrite-simalar-rules-how/
Share on other sites

Hi ollie460,

 

Put an "L" at the end of each rule, i.e.:

 

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

 

The "L" stands for "Last Rule" and basically won't process any further rewrite rules.

 

Hope this helps.

Hello,

 

I tried adding L to both of them but only the top one works still.

 

index.php?page=upload&type=ea  --- > /upload/ea

index.php?page=login&login=complete  --- > /login/complete

 

Thats what i want it to do, If i swap them around the top one will work and the other wont.

How does your rule know to differentiate between which querystring is required (login or type)

 

I am not great with rewrites, but seems it will only ever take the first one. With that rule anyways

 

Not sure wqhat rule you need though  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.