1. Apache的配置文件下,打开 LoadModule rewrite_module modules/mod_rewrite.so
2. 你网站根目录下面的AllowOverride None改为 AllowOverride All
<Directory "/var/www/html">
.................
AllowOverride All
....................
</Directory>
3. 在网站根目录下,即这里是/var/www/html(看你的DocumentRoot设定),创建.htaccess文件,写入
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^gz$ index.php
4. 这样访问 http://你的域名/gz 就会重定向到 http://你的域名/index.php.