Redirect using .htaccess from a PHP page to another both with variables -
i have simple question, cant find way it. need redirect or rewrite this:
http://mydomain.com/libro.php?isbn=9788493652470
to this:
http://mydomain.com/busqueda.php?busqueda=medimecum
i have tried doesn’t work:
redirect 301 /libro.php?isbn=9788493652470 http://mydomain.com/busqueda.php?busqueda=medimecum
a straight redirect
not work well. using mod_rewrite
rewritecond
query string work well. should work example:
rewriteengine on rewritecond %{query_string} isbn=9788493652470 rewriterule ^libro.php http://mydomain.com/busqueda.php?busqueda=medimecum [l,r=301]
now looking @ question 1 time again it’s not clear if want pass along original query string, correct? url:
http://mydomain.com/libro.php?isbn=9788493652470
would become url:
http://mydomain.com/busqueda.php?busqueda=medimecum&isbn=9788493652470
but if somehow wanted that, add together qsa
(query string append) flag rewriterule
this:
rewriteengine on rewritecond %{query_string} isbn=9788493652470 rewriterule ^libro\.php http://mydomain.com/busqueda.php?busqueda=medimecum [l,r=301,qsa]
php .htaccess redirect
No comments:
Post a Comment