RewriteEngine写法

不推荐在网站根目录采用.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]

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据