1

We are currently using the following code to redirect traffic to SSL.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.duplika.com/$1 [R=301,L]

The problem is that parked domains like www.duplika.net or www.duplika.com.br are also redirected to https://www.duplika.com.

Is there a way to redirect traffic, except the ones from this domains?

After looking at this thread, I've tried the following without success:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ^br.*$
RewriteCond %{REQUEST_URI} ^net.*$
RewriteRule ^(.*)$ https://www.duplika.com/$1 [R=301,L]
Community
  • 1
  • 1

1 Answers1

4

You need to match on %{HTTP_HOST} to filter out the domains

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} !\.(net|br)$ [NC]
RewriteRule ^(.*)$ https://www.duplika.com/$1 [R=301,L]

The above example tests that a domain does not end with .net or .br before redirecting. You might need to change the pattern based on all the domains you don't want to be redirected.

Ravi K Thapliyal
  • 51,095
  • 9
  • 76
  • 89