【发布时间】:2026-01-06 20:40:02
【问题描述】:
我在重定向一些网址时遇到问题,如下所示,有许多不同猫品种的网址。谁能帮忙解决这个问题。
重定向网址示例:
http://www.exampledomain.co.uk/cats/database.nsf/catsforsale!openform?Breed=Persian
我希望它指向下面的 url。然后我的 php 脚本应该做一些更复杂的重定向以使 url 整洁:
http://www.exampledomain.co.uk/display_pets.php?pettype=Cats&petbreed=Persian
我尝试了下面的重写,但它不起作用,它根本不重定向,我认为它可能与? :
RewriteRule ^/cats/database.nsf/catsforsale!openform?Breed=(.*)$ display_pets.php?pettype=Cats&petbreed=$1 [L]
【问题讨论】:
-
RewriteRule 仅匹配 URL 的路径部分。如果要检查查询字符串内容,则需要使用 RewriteCond。
标签: php apache .htaccess redirect mod-rewrite