Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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

hi just wondering if this is possible, when you access my default site directory localhost/mysite I want to set the path to render localhost/mysite/view/ all my HTML pages will be rendered here just like a PHP MVC structure can do... is it possible with htacces?

I'm an absolute newbie so I apologize if you find this question somehow stupid.

share|improve this question

migrated from serverfault.com Aug 15 '11 at 11:34

This question came from our site for system and network administrators.

It's not stupid so much as incomprehensible. I really have no idea what you want to achieve. Can you provide more detail? – womble Aug 15 '11 at 11:20

If I understand you correctly this should be in the parent directories .htaccess file:

<IfModule mod_rewrite.c>
# enable mod_rewrite
RewriteEngine On
# redirect to the view folder
RewriteRule    (.*) view/$1    [L]

And this should be in the .htaccess file in the view folder:

<IfModule mod_rewrite.c>
RewriteEngine On
# check to make sure this isn't a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
share|improve this answer
If you place it in htaccess you will definitely have a rewrite loop with "500 Internal Server Error" displayed to the user. – LazyOne Aug 16 '11 at 0:48
Good point @LazyOne, That's what I get for not actually testing my solution. :-) I think the revised solution should work. – Scott Keck-Warren Aug 16 '11 at 13:26

Your Answer


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