【发布时间】:2013-12-24 16:24:48
【问题描述】:
我的 url 格式mysite/profile/?theusernamewith hide php extension,我试图在 url 中隐藏问号,所以 url 会像mysite/profile/theusername,查找了几篇关于我应该做的是添加外部重定向然后在 htaccess 中进行内部转发的帖子,尝试了很多代码仍然无法正常工作。这就是我现在拥有的:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
【问题讨论】:
-
如果你忽略
RewriteCond !{QUERY_STRING} idstackoverflow.com/questions/4881410/…,这里可以回答这个问题 -
@popnoodles 我认为这是用于将链接重定向到上层目录,例如 /foo/?bar 到 /foo
标签: php regex .htaccess mod-rewrite url-rewriting