Options +FollowSymLinks
RewriteEngine On
RewriteRule ^portfolio/(.*)/?$ ./portfolio.php?project=$1 [QSA,L]
因此,当我尝试打开例如:mywebsite.com/portfolio/my-project
时,它必须转到mywebsite.com/portfolio.php?project=my-project
。
但是相反,我的 url 更改为mywebsite.com/portfolio/index.php
,它显然无法打开,因为该页面不存在。为什么要这样做?
有什么建议么?
编辑:if (isset($_GET['project'])) { ... } else header('Location: index.php')
在我的portfolio.php
页面顶部,导致了这个。所以似乎我的项目不会通过$_GET['project']
请求传递到页面?
固定:显然,我-MultiViews
需要Options +FollowSymlinks -MultiViews