重定向301以结束URL

时间:2014-10-07 04:24:36

标签: .htaccess redirect

我的域名为www.test.com/event/eventName/Current-Info,我希望这些域名重定向到www.test.com/event/eventName/Current-Registers

我试着这样做:

Redirect 301 /Current-Info /Current-Registers/但它不起作用。任何提示如何做到这一点?谢谢!

2 个答案:

答案 0 :(得分:1)

文件名:.htaccess

Options +FollowSymLinks
RewriteEngine On
RewriteRule www.test.com/event/eventName/Current-Registers www.test.com/event/eventName/Current-Info [R=301,L]

另一种方式

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)/Current-Registers$ www.test.com/event/$1/Current-Info [R=301,L]

答案 1 :(得分:1)

您可以在DOCUMENT_ROOT/.htaccess文件中使用此代码:

RewriteEngine On

RewriteRule ^(event/[^/]+)/Current-Info /$1/Current-Registers [L,NC,R=302]