HtAccess:基本 ModRewrite
给定这样的网址:
mysite.com/index.php
mysite.com/page/member/lobby.php
mysite.com/page/videos/video1.php
如何使用 .htaccess 重写网址以隐藏 /page/ 文件夹(当它存在时)?
所以最终的结果是:
mysite.com/index.php
mysite.com/member/lobby.php
mysite.com/videos/video1.php
Given urls like this:
mysite.com/index.php
mysite.com/page/member/lobby.php
mysite.com/page/videos/video1.php
How can I rewrite the urls with .htaccess to hide the /page/ folder when it's present?
So the end result is:
mysite.com/index.php
mysite.com/member/lobby.php
mysite.com/videos/video1.php
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用此规则将
page/
添加到内部路径:现在,每个 URI 路径请求都至少有两个路径段,但第一个段不是
page
将是前缀与/page
。因此/member/lobby.php
将被重写为/page/member/lobby.php
。You can use this rule to add
page/
to your path internally:Now every request that’s URI path has at least two path segments but that’s first segment is not
page
will be prefixes with/page
. So/member/lobby.php
will be rewritten to/page/member/lobby.php
.