I have dealt with using rewrites and rules to forward things in Apache or IIS. I am wondering if I have our current domain name test123.com forwarded to test678.com what will happen if someone is going to test123.com/home/products/industrial/product123?

Will it keep the underlying url behind the domain name while being forwarded? Is there anything that I should think about this before deciding? And this is SSL site using cert.

  • Just to clarify, you are just talking about DNS? – MrWhite Jan 25 '17 at 22:46
  • ...forward a domain permanently via DNS... Impossible. Cannot be done. DNS does not forward. It only assigns a domain name to an IP address and optionally assign a few other records for look-up. Nothing more. – closetnoc Jan 25 '17 at 23:03
  • @closetnoc - should have said redirect not forward. My bad on the terminology. Even redirect is a bad term, should be that old resolves to new but these are all the same concept. – blankip Jan 26 '17 at 0:29
  • It still does not forward. It does allow you to assign several domain names to an IP address or another domain name using a CNAME (alias) record, if that is what you mean. If it is, then example.com/myspiffywebpage/ should still work if aliased to otherexample.com. – closetnoc Jan 26 '17 at 0:41

It depends on your configuration.

Example: Redirect to fixed url

<VirtualHost *:80>
    ServerName test123.com
    RewriteEngine On
    RewriteRule ^.*$ https://test678.com/? [R=301,L]

This redirects every request to the url http://test123.com/ and ignores the previous url.

Don't forget the ? at the end of the hostname or the parameter part (everything that follows the ?) will be still appended.

Example: Redirect with uri

<VirtualHost *:80>
    ServerName test123.com
    RewriteEngine On
    RewriteRule ^.*$ https://test678.com%{REQUEST_URI} [R=301,L]

This sends a Location header with the old request uri intact.

Things to consider

For better google results (SEO) and UX you sould always reduce 404 errors.

If you are migrating to a new servername and the entire file hierachie remains unchanged, I would advise to use the seconds example and keep the uri as is.

If the new server doesn't contain all the old pages and would result into 404 errors you should go with the first option.

  • Your first example doesn't "redirect to a fixed url", in fact, it does the same as the second example and redirects test123.com/<anything> to test678.com/<anything>. "This sends a Location header with the old request uri" - The same as the first example, it sends a Location header with the new request URI (not the "old" one?). – MrWhite Jan 25 '17 at 22:45
  • @w3dk omg I'm so sorry - I just looked at the documentation which is not that great apparently – Ludwig Behm Jan 25 '17 at 22:51
  • 1
    I am sorry. This does not answer the OP's question. He is asking about DNS. Cheers!! – closetnoc Jan 25 '17 at 23:04
  • @closetnoc well I weren't quite sure with his grammar. Did he already changed something in Apache or IIS? Does he just want to make a CNAME? Sorry I'm new on this board and couldn't ask him in a comment. :( – Ludwig Behm Jan 25 '17 at 23:10
  • I am not kicking your butt. Honest! We all misread things from time to time and sometimes questions are just not clear. I only mention it so that you can edit your answer. I make these comments to help new users just like people did for me when I was new. Cheers!! – closetnoc Jan 25 '17 at 23:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.