如何使用 .htaccess 规则删除 .php 扩展名?
我需要我的 .htaccess 文件去掉 .php 文件扩展名,并将其替换为尾随斜杠。
另外,我有一个 profile.php 页面,通常使用数字查询字符串参数访问该页面,例如“profile.php?id=3
”。
那么,除了用斜杠替换扩展名之外,如何使“profile.php?id=3
”看起来像“profile/3/
”?
到目前为止,我所掌握的只是第一行:
RewriteEngine on
我该去哪里?
I need for my .htaccess file to take away the .php file extension and replace it with just a trailing slash.
Also, I have a profile.php page which will normally be visited with a numeric querystring parameter, like "profile.php?id=3
".
So on top of replacing extensions with slashes, how do I make "profile.php?id=3
" look like "profile/3/
"?
So far all I have is the first line:
RewriteEngine on
Where do I go from here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您是新手...您确实应该阅读手册。
但这会做你想做的。现在别偷懒了。阅读手册!
If you're so new... you really should read the manual.
But this will do what you want. Now don't be lazy. Read the manual!
这应该可以做到
This should do it