[英].htaccess file working, but not rewriting url
现在是时候隐藏get变量了,但是我的.htaccess文件不允许重写。我目前有:
RewriteEngine On
RewriteRule ^timeline/(\d.*) timeline.php?user=$1
它是timeline.php?user=chris
并且必须阅读timeline.php
我已经寻找了将近2个小时,用于复制和更改代码,但是没有任何效果。
我也变了
<Directory ..>
...
AllowOverride None
...
</Directory>
至:
AllowOverride All
请帮忙!
使用以下htaccess并尝试
RewriteEngine On
RewriteRule ^timeline/([^/]*)$ /timeline.php?user=$1 [L]
尝试这个:
RewriteRule ^timeline/(.*)$ timeline.php?user=$1
我相信您需要通过在.htaccess上方放置一行来关闭MultiViews
选项:
Options -MultiViews
MultiViews
由Apache's content negotiation module
,该Apache's content negotiation module
在mod_rewrite
之前运行,并使Apache服务器匹配文件扩展名。 因此/file
可以位于URL中,但它将提供/file.php
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.