1

Here is my situation:

I have a website ( live ) which user accesses as:

http://olddomain.com/news

I have another website which user accesses like:

http://newdomain.com/news

(/news being an example of a page of the website).

These are basically 2 different websites, but with exact same content.

I would like if user accesses to the website by the old domain: http://olddomain.com/news

to be automatically redirected to http://newdomain.com/news

Is there any plugin or htaccess rules or other to make this work?

I can't find any information about this, it will be amazing to have some highlight about that!

Thank you for all your time!

Sushant Tayade
  • 122
  • 4
  • 17
tibewww
  • 593
  • 4
  • 11
  • 32

2 Answers2

1

Use this .htaccess in olddomain.com

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>
Miro
  • 8,402
  • 3
  • 34
  • 72
  • thank you for your time, unfortunately, it seems to not change anything, if i write http://olddomain.com/page it keeps going to http://olddomain.com/page instead of http://newdomain.com/page Do you have any idea why ? – tibewww Apr 06 '16 at 21:47
0

As you said

these are basically 2 different websites - but with the exact same content

If eventually you are going to redirect user for every page on oldsite.com , then you can point olddomain.com to newdomain.com

check here: How to point two different domain names to a single website?

Edit: Just found this.If you want to redirect users for every page on olddomain then you can try something from here: .htaccess redirect all pages to new domain

Sushant Tayade
  • 122
  • 4
  • 17
  • Thanks for that, unfortunately, I can't change the DNS of the domains for some other reasons....:/is there any other way around ? htacess ? plugins ? other ? Thank you :) – tibewww Apr 06 '16 at 22:02