Welcome Guest, Not a member yet? Register   Sign In
Redirect url to new domain
#1

I'm going to move my website to a new domain. All URL's remain the same, except for the base url name.
Visitors who visit the old domain, should be forwarded to the new one. It's ok if they are redirected to the home page on the new domain.
For example, all these URL's:
www.domain1.nl
www.domain1.nl/contact
www.domain1.nl/news
etc.
should be forwarded to:
www.domain2.nl

I've tried .htaccess with 301 redirect rules, but I can't get it working.
Reply
#2

I am not a .htaccess expert by a very long way indeed, but this should work:

Code:
Redirect 301 / http://example.com/

If you have set up a redirect on the domain with your cpanel this will stop the htaccess from working. Check there are no hosting redirects set up.

What were you using for your .htaccess that is not working?

Hope that helps,

Paul.
Reply
#3

(This post was last modified: 10-23-2015, 07:38 AM by Wouter60.)

I discovered that my .htaccess was ignored by the server, because it wasn't ANSI. I changed that, and now it does execute the .htacccess.

Still, there is one issue left.
My .htaccess looks like this:
Code:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain1\.nl$ [NC]
RewriteRule ^(.*)$ http://www.domain2.nl [R=301,L]

If a visitor enters www.domain1.nl, there's an error. If he enters domain1.nl (without the www), the url is redirected correctly.
If a visitor enters domain1.nl/contact, there's an error. And when he enters www.domain1.nl/contact, the url is redirected.
How can I correct this behaviour? I want all URL's that point to domain1 (with or without www) redirected to domain2.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB