0

I have a client that purchased their original domain (.net) and then bought the .com domain as well, then asked me to redirect all traffic to the .com site, everything seemed to go according to plan... until I noticed if I had a page bookmarked, or typed the entire URL with the .net extension, the address would not rewrite to .com.

Example: if I navigate to example.net/page I want the address to change to example.com/page (whereas at the moment it is not)

Here's my .htaccess file

RewriteCond %{HTTP_HOST} ^promotionstudios\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.promotionstudios\.net$
RewriteRule ^(.*)$ "http\:\/\/www\.promotionstudios\.com\/" [R=301,L]

Any insight is appreciated! Thanks in advance!

Jason Herz
  • 23
  • 5
  • The code you show just redirects the root directory (= literal calls to www.promotionstudios.net). For a solution that redirects *all* traffic, Google `htaccess redirect all traffic` – Pekka Apr 28 '16 at 21:30
  • Possible duplicate of [Redirect all traffic to root of another domain](http://stackoverflow.com/questions/8819706/redirect-all-traffic-to-root-of-another-domain) – Pekka Apr 28 '16 at 21:33

2 Answers2

2

Use:

RewriteCond %{HTTP_HOST} ^(?:www\.)?promotionstudios\.net$ [NC]
RewriteRule ^ http://www.promotionstudios.com%{REQUEST_URI} [NE,R=301,L]
Croises
  • 18,570
  • 4
  • 30
  • 47
-1

Better option than using htaccess is Domain Forwarding

Note: According to service provider option names may differ. But it will be surely there.

Login to your .net Domain Account and select your .net domain.

Under Domain Forwarding--> Manage Domain Forwarding enter image description here

Make sure

URL Masking: OFF (if this is ON,example.com/page will be shown with example.net/page as url in the browser)
Sub Domain Forwarding: ON  (in case if you need your subdomains forwarded)
Path Forwarding: ON  (this will forward example.net/page to example.com/page)

Then save.

Next

Under Domain Forwarding-->Name Server Details enter image description here

From here you will get the Name Server details.

Next

Under Domain Registration-->Name Servers

Fill the Name Server details got before and click Update Name Servers.

Now you are done.

Note:These changes may require 24–72 hours to take effect

Rijul Sudhir
  • 2,064
  • 1
  • 15
  • 19