Home >Backend Development >PHP Tutorial >关于.htaccess 文件无法正确的识别

关于.htaccess 文件无法正确的识别

WBOY
WBOYOriginal
2016-06-20 12:46:55960browse


  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.+?\.(ico|gif|jpg|jpeg|png|html|js|css|map|ttf|woff|woff2))$ /static/$1 [L]
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  
  



以上是我写的.htaccess文件代码,可是我将文件放在项目的目录下,仍然无法使用,求大神帮忙看一下


回复讨论(解决方案)

apache是否开启伪静态?



你的rewrite是否已开启?

如未开启可以使用以下命令开启
sudo a2enmod rewrite

已经解决  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 
这里的 index.php后面加一个问号就好了,不知道是什么情况

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn