Forum Moderators: phranque
# When a request comes in requesting index.html from the document root,
# respond with an HTTP 301 response ("move permanently") providing a new location
# and stop processing rewrite rules
RewriteRule ^index.html$ http://www.mysite.com/mysite/ [R=301,L]
# When any request comes in return the content at /mysite/
# using an internal rewrite and stop processing further rules... however
# if done in a .htaccess context, the rewritten URL will be rechecked and
# match again, probably resulting in a recursive loop.
RewriteRule (.*) /mysite/ [NC,L]
[code]
Do you want [i]all requests[/i] to start in /mysite/? (e.g. a request for [code]http://www.mysite.com/image.jpg would return an image whose file location is mysite/image.jpg, relative to the document root)? If you have just moved the enture site from the document root do the mysite subdirectory, you could probably set RewriteBase to /mysite/. But if you want the /mysite/ directory to be visible to users, then you need to do a 301 redirect.
# Externally redirect direct client requests for URL-paths starting with /mysite back to root URL-path
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /mysite/
RewriteRule ^mysite/(.*)$ http://www.example.com/$1 [R=301,L]
#
# Internally rewrite requests for URL-path /index.html to filepath /mysite/
RewriteRule ^index\.html$ /mysite/ [L]
#
# Internally rewrite all requests to /mysite subfolder, unless already done
RewriteCond $1 !^mysite/
RewriteRule ^(.*)$ /mysite/$1 [L]