I've changed the domain of my site, created a redirect, but it seems to work only partially. That is, when I go to example.co.il (old) I do get to example.biz (new).

But when I go to example.co.il/just-a-nice-webpage-111 I get a 404?

Please tell me what can cause it, here is my domain.co.il folder htacess syntax:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.co.il$ [NC]
RewriteRule ^(.*)$ http://example.biz/$1 [R=301,L]
  • Such questions are OT here. System and network administration -- Server Fault participants are much more likely to know the technical details on topics such as DNS and Apache configuration than people who answer questions here. – Rob Feb 20 '16 at 13:35
  • 4
    @Rob Not really. We answer questions like this all the time and the questions are not put on hold. This is primarily a question about an error in a redirect using .htaccess. – closetnoc Feb 20 '16 at 15:58
  • Does it redirect? Does example.biz/just-a-nice-webpage-111 exist? Do the old and new domains both resolve to the same site? – MrWhite Feb 20 '16 at 18:37
  • @closetnoc Yes, I've seen that, but it's still against the rules I quoted and the question is directly in line with what serverfault is for. I've also seen HTML and CSS questions here, which are specifically OT, but, when I flag them, I'm told there's nothing wrong with that despite those, too, being specifically off topic here. – Rob Feb 21 '16 at 0:15

In order for this to work, you must retain the example.co.il domain and place the following redirect code in your .htaccess within the example.co.il web root.

RewriteEngine on
RewriteRule ^(.*)$ http://example.biz/$1 [L,R=301]

You do not need to check the host name.

If you make a request for a page that does not exist on domain.biz you will get a 404 error as you should. This is correct.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy