my11502207 发表于 2017-1-10 08:43:51

apache rewrite 隐藏 php 入口文件index.php

  1. 先加载mod_rewriter
  在ubuntu 下 cgi 方式的 apache 下,先让mod_rewrite 生效
  ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
  2. 在web 站点配置,
     <directory "..."></directory>中有“allowoverride none” 改成  allowoverride FileInfo Options
  3.在web根目录下加.htacess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond $1 !^(index.php|flash|img|css|js|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1
</IfModule>
页: [1]
查看完整版本: apache rewrite 隐藏 php 入口文件index.php