Mobile app version of vmapp.org
Login or Join
Tiffany637

: Most efficient way to forward domain.com to example.com/subfolder? Title says my entire question. I think I saw someone forward domain.com to example.com/subfolder and have spent about a week trying

@Tiffany637

Posted in: #301Redirect #Dns #Htaccess #Subdomain

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!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany637

1 Comments

Sorted by latest first Latest Oldest Best

 

@Barnes591

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

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

The ^(*.)$ captures any request on domain.com.
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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme