不推荐在网站根目录采用.htaccess 文件,会降低网站性能
301重定向
[perl]
RewriteEngine On
RewriteRule ^/old.html$ http://localhost/index.php [r=301]
[/perl]
重写查询字符
[perl]
RewriteEngine On
RewriteRule ^/products/([^/]+)/([^/]+) /product.php?id=$1&name=$2
[/perl]
404重定向
[perl]
RewriteEngine On
ErrorDocument 404 /404.html
[/perl]