【发布时间】:2015-10-24 16:52:10
【问题描述】:
我搜索了很多,但找不到解决方案。我正在尝试将带有参数的基于 php 的 url 重定向到 SEO 友好的 url。
例如,我想将 static.php?content_id=27 重定向到 /presentation/,但出现无限循环错误。
这是我的代码:
RewriteEngine On
RewriteBase /
RewriteRule ^presentation/$ static.php?content_id=27
RewriteCond %{QUERY_STRING} content_id=27
RewriteRule ^static\.php$ /presentation/? [L,R=301]
旧网址已被 google 索引,因此我需要此重定向。
谢谢
【问题讨论】:
-
查看mod-rewrite的标签wiki。
标签: php apache .htaccess mod-rewrite redirect