Using .htaccess to redirect to (or mirror) a folder... am I doing it right?
Designer cosplaying as a programmer here (and have been for 10 years), so feel free to dumb down those replies, I won't be insulted. ![]()
So here's the thing... I currently have all my landing pages in the domain.com/pages folder. However, I'd like to clean up my urls so that the redundant /pages portion of the url is removed from the user's view, by having domain.com/welcome.php forward to where the actual page is stored, domain.com/pages/welcome.php.
I've run some tests, and a simple...
redirect 301 /welcome.php /pages/welcome.php
...will accomplish this. And since I don't plan on having more than a dozen pages on this site, I could just do this for each page, on 12 separate lines in the .htaccess file.
However, with this method, the user can see there was a redirect there, because the link they clicked isn't where they ended up.
If there was a way to simply mirror the /pages folder at the root, that would probably solve everything with 1 line. But then, how would files like .htaccess, robots and favicon get read by the browser ? If I did this, would I have to move everything but .htaccess (including robots + favicon) to /pages for the browser to read them? I smell unforeseen complications down the line.
So should I just give up the idea of mirroring (to mask the fact that these are redirects) and just be glad I can redirect with minimal fuss?
Or is there a better way to tell .htaccess to do something like this?
mirror /welcome.php /pages/welcome.php
(I know that's not a real thing, just made it up to illustrate what I'm trying to achieve.)
I welcome your advice.
Thanks!
