Tell me more ×
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
1  
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

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

1 Answer

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]
</IfModule>

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
</IfModule>
share|improve this answer
1  
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

 
discard

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