.haccess 配置生效

前言:网上看到有写用.haccess会影响到网站速率之类的,这里只是讲解自己的一点配置.haccess的心得,其它的之后再讨论哈~

1、普通配置:

网上都有的那种配置   apache/conf/httpd.conf  配置

搜索LoadModule rewrite_module modules/mod_rewrite.so 如果前面有注释符号#,请去掉。
搜索Options FollowSymLinks,然后将它下面的AllowOverride None 修改为AllowOverride All;

2.检查.htaccess文件 , 很多框架都是index.php当入口文件。    [注:我就是被坑在这]

默认的

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

规则在apache fastcgi模式下会导致No input file specified.

修改成

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

就OK,地址正常重写。

原文地址:https://www.cnblogs.com/yuanyuanyuan/p/8544896.html