Ahtenus
Ahtenus

Reputation: 595

Redirect only when on a specific domain

I got the domains example.com and example.se and I'm discontinuing the example.com domain soon so i want some kind of redirect.

Both domains point to the same directory on my web hotel so all files are the same on both domains.

What are the best way to make people (and google) access the example.se domain intead of example.com?

The webserver runs Apache and i got limited control (shared hosting).

Upvotes: 2

Views: 1618

Answers (1)

Álvaro González
Álvaro González

Reputation: 146540

This should do the trick:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^example\.se$
RewriteRule ^.*$ http://example.se/$0 [L,QSA,R=301]

The 301 status code is for permanent redirections.

Upvotes: 4

Related Questions