mod de reescritura de URL múltiple

I have two pages say

http://assistque.com/services.php?prod_id=35&prod_url=Operating%20System%20–%20Windows

e

http://assistque.com/sub_services.php?sp_id=13&sp_url=Technical%20Support%20For%20KASPERSKY

i wrote two rules for two different pages but the for the second page it uses first rule .

Por favor, ayuda

RewriteRule ^([^/]*)/([^/]*)\.html$ /services.php?prod_id=$1&prod_url=$2 
RewriteRule ^([^/]*)/([^/]*)\.html$ /sub_services.php?sp_id=$1&sp_url=$2

preguntado el 28 de mayo de 14 a las 12:05

do i need to modify the url as <a href="../13/Technical%20Support%20For%20KASPERSKY">Technical Support</a> Im doing it this way.. or Should not change the url and keep it as <a href="sub_services.php?sp_id=13&sp_url=Technical%20Support%20For%20KASPERSKY">Kaspersky</a> -

1 Respuestas

This is because the patterns in the both rules are the same, try changing them into something unique:

RewriteRule ^services/([^/]*)/([^/]*)\.html$ /services.php?prod_id=$1&prod_url=$2 [L]
RewriteRule ^subservice/([^/]*)/([^/]*)\.html$ /sub_services.php?sp_id=$1&sp_url=$2 [L]

Then in your links you add something like:

<a href="http://exampel.com/services/35/operating-systems-windows.html">operating systems windows</a>

Note, that you should not use spaces inside an url, so in this case I assume those will be replaced with an - carácter.

It may also be better to narrow down allowed characters and numbers in your rewrite rule:

# will match services/<number>/<string>.html
# the NC flag states that the rule is case insensitive
RewriteRule services/([0-9]+)/([a-z-]+)\.html$ /services.php?prod_id=$1&prod_url=$2 [NC,L]

contestado el 28 de mayo de 14 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.