mod_rewite Rule: root/? root/app/views/home/home.php
- by Jonathon David Oates
I am shocking at mod_rewite, here's the scenario:
I need a rule that rewrites mydomain.com to mydomain.com/app/views/home/home.php.
The rule, or set of rules rather, must also rewite mydomain.com/signin to mydomain.com/app/views/signin/signin.php, and work in a similar fashion for any subdirectory, for example: mydomain.com/subdir must redirect to mydomain.com/app/views/subdir/subdir.php.
The rules must also work with or without the trailing slash, for example: ….com or ….com/.
Thank you all, your help is much appreciated!
If you could outline how and why your solution works or direct me to a good resource that explains it, I'd be exceptionally grateful!
Edit: I have got a simple .htaccess file with this:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^$ http://mydomain.local/~Jay/some_awesome_app/app/views/home/home.php
This does the redirect but changes the URL in the address bar too! I've not got a trailing [R] flag so why would this be?