ubnutu 环境下 在APACHE服务器上的访问模式上去除index.php

ubnutu 环境下 在APACHE服务器上的访问方式上去除index.php




1.在APACHE里面去配置 ,将里面的AllowOverride None都改为AllowOverride All
在这里我用的是 Apache2.4.7版本。其实下面红色框中在Apache2.4.7中是没有的,直接添加上就行了。
/etc/apache2/sites-enabled/000-default.conf 中

ubnutu 环境下 在APACHE服务器上的访问模式上去除index.php
 <Directory /var/www/payserver/ >
                Options FollowSymLinks
                AllowOverride All
                Order deny,allow
                Deny from All
                Allow from All

         </Directory>




注意:修改之后一定要重启apache服务。 


2.在终端中执行
sudo a2enmod rewrite


3 .htaccess文件必须放到跟目录下 这个文件里面加: 

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php/$1 [L] 

版权声明:本文为博主原创文章,未经博主允许不得转载。