I have a simple hosting account, and the folder structure is as follows:
/ (web root)
|
|-domain1
|-domain2
|-domain3
|
...
Due to some server migrations going on, I needed to have a real domain pointed at the web root, let's say domain0.com
with or without the www
I need an .htaccess file that forces all access to index.php
page when you access http://domain0.com/
For example, you would be unable to render domain1's
website by loading http://domain0.com/domain1/
and instead be forced to go to http://domain0.com/index.php
I have tried writing it on my own, but keep blowing up the server with bad redirects. Any help?
Your own redirects were most likely recursively redirecting to the index.php. You need to block the rule for that script, so it isn't run on that page request, e.g.:
This should be put above any conflicting RewriteCond/Rule's, so they wont interfere with the redirection.
Any .htaccess files in subdirectories will by default remove this rule and not do the redirect. To fix them, you must add either the rule again to them, or set them to inherit from parent .htaccess files, e.g.: