htaccess将整个域重定向到另一个域,但为特定的url进行自定义重定向

问题描述:

我需要为域进行一些重定向。htaccess将整个域重定向到另一个域,但为特定的url进行自定义重定向

基本上我需要的是下面的解释。

重定向整个domain.net到domain.com,但留下一个自定义的重定向,像这样:

domain.net/specific_url.html to domain.com/my_new_url.html 

你可以试试这个。

RewriteCond %{HTTP_HOST} ^(www\.)?example\.net 
RewriteRule ^(.*)$ http://example.com [R=301,L] 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net 
RewriteRule ^specific_url/? http://example.com/new_url [R=301,L] 
+0

第一部分工作...(重定向所有域),但异常(specific_url)没有正确重定向。我正在尝试一些修改... – TheAgent

+0

行。我只是把第二个条件和规则放在第一个条件和规则之上。 – TheAgent