简体   繁体   English

301将.htaccess的所有流量重定向到特定的域和uri

[英]301 redirect .htaccess all traffic to specific domain and uri

I am lost... as always the htaccess file is like vodoo... i am trying to redirect all traffic from a domain regardless of its URI to a specific page on another domain. 我迷路了……htaccess文件始终像伏都教一样……我正试图将所有流量从一个域重定向,无论其URI如何都重定向到另一个域上的特定页面。 This is what I have and it is failing with a 500 error: 这是我所拥有的,并且失败并显示500错误:

RewriteCond %{HTTP_HOST} (^|\.) domain\.com$
RewriteRule ^ https://www.example.com/some/other/page/ [L,R=301]

Can someone tell me what I am doing wrong? 有人可以告诉我我在做什么错吗? Like I said I am trying to ignore the URI requested and force a redirect to a specicif page on another domain. 就像我说的那样,我试图忽略所请求的URI,并强制重定向到另一个域上的特定页面。

If you want to redirect everything from domain.com (and also every subdomains), try this way 如果您想从domain.com (以及每个子域)重定向所有内容 ,请尝试这种方式

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(.+\.)?domain\.com$ [NC]
RewriteRule ^.*$ https://www.example.com/some/other/page/ [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM