一.apache 服務器配置問題
vim /usr/local/apache2/conf/httpd.conf
在ifModule這里加入index.php
<IfModule dir_module> DirectoryIndex index.html index.php #這里原來沒有index.php </IfModule>
在加入
<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
此時的.htaccess文件為
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(\.html)$ [NC] RewriteRule ^/?(.*)$ /$1.html [QSA,R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] #//第二種方法 </IfModule>
