simple htaccess issue

By : Arun SS
Source: Stackoverflow.com
Question!

I have a simple htaccess issue. In my localhost I have a folder mysite. mysite has three subfolders.

  1. html
  2. dev
  3. images

I have put my htaccess in mysite folder. My rule is if anyone access site through http://localhost/mysite it should read files from html folder. My current htaccess is follows

RewriteBase /

RewriteEngine on

RewriteCond $1 !^(index\.php|images|css|dev|js|robots\.txt)

RewriteRule ^(.*)$ html/index.html$1 [L]

That is http://localhost/mysite/aboutus.html should show files in http://localhost/mysite/html/aboutus.html

-Arun

By : Arun SS


Answers

Try:

RewriteEngine On
RewriteBase /mysite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(. )$ html/$1 [QSA]

To clarify a bit more, it doesn't rewrite any existing files and directories and rewrites everything to the directory html.

By : ChrisH


This video can help you solving your question :)
By: admin