htaccess的重定向到另一个领域 - 特定页面,然后剩下的去主页重定向、领域、页面、主页

由网友(冲动自恋男)分享简介:我在重定向的老站点到另一个域的过程。使用htaccess的我列出40-50特定页面被重新定向到它等同于新的领域,即:重定向301 /delivery.php http://www.newdomain.com/delivery/重定向301 /contact.php http://www.newdomain.com/c...

我在重定向的老站点到另一个域的过程。使用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/
 

301重定向怎么做

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/

阅读全文

相关推荐

最新文章