Redirect a domain to a site

Hi,

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?

Thanks

Andre
andre72Asked:
Who is Participating?
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.

stergiumCommented:
you should add php code on it.
<?php header("Location: http://www.example.com/"); ?>
hope that helps
0
aamodtCommented:
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
0
stergiumCommented:
the apache way (if you prefer it ) will be to edit httpd.conf
and set this up.
ServerName olddomain.com
Redirect permanent / http://www.domain.com
0

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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

aamodtCommented:
But DNS are not intended to do redirects. so its like a "voliation" of dns
0
dsmileCommented:
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

0
SylvainSSiriCommented:
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!
0
andre72Author Commented:
This works fine, thanks
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.