Redirect a domain to a site


I have a domain, eg. mydomain.tld and like to have a referer to a site on a other server for, eg. myotherdomain.tld/?ID=4711

No need to keep params for ID=4711 is a fix target.
I know about solution with JavaScript and / or HTML header but how about apache - is there a solution for and if so how can I do?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you should add php code on it.
<?php header("Location:"); ?>
hope that helps
Yeah, you can't do with apache. need to be a index file that redirects with header in PHP or redirection in HTML.

There are some tricks you can do in DNS to do "url redirection"  if you want that solution
the apache way (if you prefer it ) will be to edit httpd.conf
and set this up.
Redirect permanent /

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

But DNS are not intended to do redirects. so its like a "voliation" of dns
Just create .htaccess with below content and put in your document root

Version 1: keep requested path
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mydomain.tld$[OR]
RewriteCond %{HTTP_HOST} ^mydomain.tld$
RewriteRule ^(.*)$ http://www.myotherdomain.tld/$1 [R=301,L] 

Open in new window

Version 2: just redirect
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mydomain.tld$[OR]
RewriteCond %{HTTP_HOST} ^mydomain.tld$
RewriteRule ^(.*)$ http://www.myotherdomain.tld/ [R=301,L] 

Open in new window

Version 3: redirect with fixed ID
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mydomain.tld$[OR]
RewriteCond %{HTTP_HOST} ^mydomain.tld$
RewriteRule ^(.*)$ http://www.myotherdomain.tld/?ID=4711 [R=301,L] 

Open in new window

Why not use a opendns?It is easy to use,and it redirects to whatever you want.You can use whatever dns there is also,but it would be simpler for you!
andre72Author Commented:
This works fine, thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.