使用 mod_rewrite 将基本 $_GET 变量重写为友好 URL
我知道类似的问题很常见。我只是不知道从哪里开始用 / 和 . 重写规则我不知道如何将其他人的解决方案改造为我的解决方案。关于我的情况:
我正在对index.php文件使用基本的获取,看起来
http://www.example.com/index.php?page=about
我想重写它,因为
http://www.example.com/about
我知道这是相当简单的重写明智的,但它只是一种完全不同的语言,我尝试过但未能理解。谢谢
I know questions similar to this are common. I just don't even know where to begin with rewrite rules with the /'s and .'s I don't know how to retrofit other peoples solutions to mine. Onto my situation:
I am using a basic get on the index.php file that looks like
http://www.example.com/index.php?page=about
I want to rewrite that to
http://www.example.com/about
I know this is fairly simple rewrite wise, but its just a totally different language which I have tried and failed to comprehend. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
甚至:
注意:
.htaccess
文件中设置RewriteBase
。index.php
拾取未映射到真实文件的任何字符串index.php
不匹配”Or even:
Note:
RewriteBase
in an.htaccess
file.index.php
picks up any string which isn't mapping to a real file(?!index.php\b)
is a regexp which says "but don't match toindex.php
"