1

我需要将几个页面重定向到一个新页面,最简单的解释方法是......

http://www.example.com/numbers/0800/bronze.htmlhttp://www.example.com/numbers/0800/bronze-new.html

http://www.example.com/numbers/0845/bronze.htmlhttp://www.example.com/numbers/0800/bronze-new.html

任何想法如何在一个 htaccess 规则中执行此操作?谢谢!

4

1 回答 1

1

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_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]
于 2013-09-20T10:28:56.493 回答