我有我的网页重定向如下:的.htaccess重定向 - 更改文件名和查询字符串命令
,如果我有
mysite.com/abc.php?id=12345
我要重定向到
mysite.com/def/12345.html
如果我有
mysite.com/abc.php?id=55626
我得重新搜索吨至
mysite.com/def/55626.html
请告知
=================================== ==================
下面的代码解决我的问题
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^abc\.php$ http://mysite.com/def/%1.html? [R=301,L]
那你试试到目前为止,什么是错的? – 2011-04-24 15:52:02
使用'.php'指示我,作为一个查看器,有PHP脚本驱动的事情。那么为什么你使用'.htaccess'而不是'header()'? – 2011-04-24 15:52:52
我没有使用重定向规则的经验。 abc.php和def都是.php文件。 12345.html是查询字符串。 我需要我的路径看起来像一个静态页面.html埠它仍然.php文件 – Igal 2011-04-24 16:21:11