简单的301重定向问题

时间:2015-04-24 11:22:08

标签: .htaccess http-status-code-301

在我的.htaccess文件中,我有以下重定向:

Redirect 301 /concrete5-themes/street/ http://www.c5themes.co.uk/street-theme-for-concrete5/

但是,这会将您发送到http://www.c5themes.co.ukstreet,这显然是错误的。

出了什么问题?

由于 戴夫

1 个答案:

答案 0 :(得分:2)

尝试在 .htaccess 的顶部尝试:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^(www\.)?c5themes\.co\.uk$
RewriteRule ^concrete5-themes/street(.*) http://www.c5themes.co.uk/street-theme-for-concrete5/ [R=301,L]

示例输入:

  

http://www.example.co.uk/concrete5-themes/street/1/1 {
{3}}

重定向:

  

http://www.example.co.uk/concrete5-themes/street

您可以在此处进行试验:http://www.c5themes.co.uk/street-theme-for-concrete5/