我需要将几个页面重定向到一个新页面,最简单的解释方法是......
http://www.example.com/numbers/0800/bronze.html致http://www.example.com/numbers/0800/bronze-new.html
http://www.example.com/numbers/0845/bronze.html致http://www.example.com/numbers/0800/bronze-new.html
如何在一个htaccess规则中执行此操作?谢谢!
答案 0 :(得分:1)
通过httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在.htaccess
目录下的DOCUMENT_ROOT
中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !-new\.html$ [NC]
RewriteRule ^(numbers/.+?)\.html$ /$1-new.html [L,R,NC]