Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 an 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.

thanks so much in advance :)

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

1 Answer 1

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 Warren Aug 16 '11 at 13:26

Your Answer


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