ThinkAdmin Apache URL重写

有时候我们希望隐藏URL中的index.php,着时候我们可以通过URL重写来实现。

1:修改Apache服务的httpd.conf配置文件,将模块mod_rewrite.so模块加载进来

2:修改AllowOverride None为AllowOverride All

3:在入口文件处(public下)添加或修改 .htaccess 文件


  Options +FollowSymlinks -Multiviews
  RewriteEngine On

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

以上是ThinkAdmin3.0的修改方法。

ThinkPHP5.0 RewriteRule写法为  ^(.*)$ index.php?/$1 [QSA,PT,L]

ThinkPHP5.1 RewriteRule也有写法  ^(.*)$ index.php [L,E=PATH_INFO:$1]

你可能感兴趣的:(php,php)