Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Title says my entire question. I think I saw someone forward domain.com to example.com/subfolder and have spent about a week trying to figure out how to best do this..

My goal is to have user type in domain.com?id=cow and go to example.com/subfolder/index.php?id=cow, yet still see domain.com?id=cow in the address bar.

I've messed with masking, DNS, looked a little into htcaccess (i've done very very little in htcaccess) I'm really at a loss as to what to type into google to find what i'm trying to do, any guidance would be appreciated!

share|improve this question
Quick and dirty: option one is to use iFrames on the http://domain.com/?id=cow to show the content of http://example.com/subfolder/index.php?id=cow and option two is (since it's PHP) to actually get the contents of the (remote?) website and render it where you want it (use cURL or file_get_contents or something). – ionFish Jan 4 '13 at 3:20

You may want to do this with mod_rewrite on domain.com. A simple RewriteRule to redirect your example would be:

RewriteRule ^(.*)$ http://example.com/subfolder/index.php [L,QSA]

The ^(*.)$ captures any request on domain.com.

http://example.com/subfolder/index.php is where you want people to end up

The L tells mod_rewrite to stop matching and go. QSA stands for Query String Appended and should preserve the query string.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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