0

I have transferred my blog to newdomain.nl on the same apache server where olddomain.nl is hosted. In the DNS settings of the hostingprovider I can set a redirect to http://newdomain.nl. This works only for this url. Any page or other reference do not work resulting in a "not found" 404 error. I want to discontinue the hosting of the olddomain and I only see solutions using .htaccess on olddomain.nl .

Will "RewriteRule ^(.*)$ http://www.newdomain.nl/$1 [R=404,L]" on newdomain.nl do the trick? And will there be no risk of a loop? For the latter problem: could adding ?~404 to the new url help in testing to prevent a loop? How to code that?

  • Use a `RewriteCond` before the rule, to check what the HOST_NAME of the request contained. – CBroe Apr 06 '20 at 09:43
  • Thanks for the suggestion. For now I have emptied the hosting of the old blog, leaving a .htaccess redirect there that works and setting DNS to the old blog. I am no pro at Apache so I don't think it is a good idea to try to follow your suggestion myself. (For instance I didn't know what the ",L" stood for) so I hope someone can write sample code where I only have to change the domain name. – Victor Onrust Apr 14 '20 at 11:46
  • Example how to use RewriteCond to make the following rule only take effect when a specific request host name is matched can be found here: https://stackoverflow.com/a/10241757/1427878 - _“(For instance I didn't know what the ",L" stood for)”_ - documentation exists, please don’t expect us to read it _for_ you. – CBroe Apr 14 '20 at 14:01
  • Thanks, I will try it later, also because it uses parameters unknown to me on the end which I would have to look up first, as I did with the "L" by myself. I just hoped I would find some code that works without having to look up the exact meaning. – Victor Onrust Apr 16 '20 at 08:52

0 Answers0