Domanda

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. This is what I have and it is failing with a 500 error:

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.

È stato utile?

Soluzione

If you want to redirect everything from domain.com (and also every subdomains), try this way

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(.+\.)?domain\.com$ [NC]
RewriteRule ^.*$ https://www.example.com/some/other/page/ [R=301,L]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top