htaccess的重定向到另一个领域 - 特定页面,然后剩下的去主页 [英] htaccess redirect to another domain - specific pages then remaining to go to homepage

查看:93
本文介绍了htaccess的重定向到另一个领域 - 特定页面,然后剩下的去主页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在重定向的老站点到另一个域的过程。使用htaccess的我列出40-50特定页面被重新定向到它等同于新的领域,即:

 重定向301 /delivery.php http://www.newdomain.com/delivery/
重定向301 /contact.php http://www.newdomain.com/contact-us/
重定向301 /about.php http://www.newdomain.com/about/
重定向301 /stores/finder.php http://www.newdomain.com/branch-finder/
...
 

然后我有大概在600-700等环节在哪里我也不需要他们去一个特定的页面,只是新域主页。有没有一种方法可以让我有一个'和所有其他网页回到首页线或命令只是去 http://www.newdomain.com ?否则,我将不得不手动键入,并输入每一个

解决方案
  

有没有一种方法可以让我有一个'和所有其他网页回到首页行

当然可以,你可以有这个规则为您的最后一条规则

  RedirectMatch 301 ^ / + http://www.newdomain.com/
 

I am in the process of redirecting an old site to another domain. Using htaccess I have listed around 40-50 specific pages to be re-directed to it's equivalent on the new domain i.e:

redirect 301 /delivery.php http://www.newdomain.com/delivery/
redirect 301 /contact.php http://www.newdomain.com/contact-us/
redirect 301 /about.php http://www.newdomain.com/about/
redirect 301 /stores/finder.php http://www.newdomain.com/branch-finder/
...

I then have probably around 600-700 other links where i don't need them to go to a specific page, just the new domains homepage. Is there a way I can have a 'and all other pages go to homepage' line or command to just go to http://www.newdomain.com? Otherwise I will have to manually type and enter each one

解决方案

Is there a way I can have a 'and all other pages go to homepage' line

Yes sure you can have this rule as your last rule:

RedirectMatch 301 ^/.+ http://www.newdomain.com/

这篇关于htaccess的重定向到另一个领域 - 特定页面,然后剩下的去主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆