apache2中php的url重写
作者:gcbeen
日期:2014年03月23日
apache2中php url重写
1.apache2加载mod_rewrite.so模块。
cat /etc/apache2/mods-available/rewrite.load LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so a2enmod rewrite
2.项目目录下的.htaccess文件
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
3.apache2项目配置文件
AllowOverride All <FilesMatch "^\.ht"> Require all granted </FilesMatch>
blog comments powered by Disqus