Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
Solved the Edit: should read `RewriteRule ^$ /~Jay/some_awesome_app/app/views/home/home.php –  Jonathon David Oates Feb 11 '11 at 14:05

1 Answer 1

up vote 0 down vote accepted
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^$ /~Jay/awesome_app/app/views/home/home.php [L]
RewriteRule ^([a-z0-9_]+)/?$ /~Jay/awesome_kindle_app/app/views/$1/$1.php [L]
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.