ReWrite 问题:如何将www.myhost.com/pub/abc.php?id=a 转换成www.myhost.com/pub/a.html?

microluck 2003-12-30 11:16:05
我在.htaccesss里写了:

RewriteEngine on
RewriteBase /
RewriteRule /pub/(.*)\.html /pub/abc\.php?id=$1 [R,NE,NC] [P]

然后通过url:(假设id=aaa)
http://www.myhost.com/pub/aaa.html
去访问http://www.myhost.com/pub/abc.php?it=aaa
但是显示该页无法找到.
此时网站的其它页面可以正常访问.

请高手指点. 100分聊表谢意.
QQ:48427785
...全文
39 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
microluck 2003-12-31
  • 打赏
  • 举报
回复
你好象理解反了:-)

我的意思是用户在ie里, 直接访问http://www.myhost.com/pub/aaa.html


但我的服务器实际去执行http://www.myhost.com/pub/abc.php?it=aaa
youbest 2003-12-31
  • 打赏
  • 举报
回复
不用这么复杂吧

abc.php中的内容
<?php
header("Location: http://www.myhost.com/pub/".$_GET["it"].".html");
?>
就可以了.

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧