首先我们要开始重写设置:
a2enmod rewrite
然后重启apache2
/etc/init.d/apache2 restart
然后就是靠程序自己创建.htaccess文件了。如果程序没权限那么设置下文件夹的权限为777。
这是.htaccess文件里面的内容大概是这样的:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
以上。htaccess文件(如果放在你的DocumentRoot)将所有流量重定向到,除非该文件存在DocumentRoot的一个index.php文件。