一.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>

 

相关文章:

  • 2021-06-29
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2021-09-09
  • 2021-07-01
  • 2021-07-21
猜你喜欢
  • 2021-09-27
  • 2022-12-23
  • 2021-04-03
  • 2022-01-18
  • 2021-06-23
  • 2022-12-23
相关资源
相似解决方案