I've things i initially assumed to become a simple problem. I'm using hosting that is shared for this site (and so i don't have the Apache configuration) and also have only received just one folder to keep my content in. This really is all fine and dandy however it implies that my subdomains should have their virtual document root's inside
public_html, meaning they effectively be a folder on my small primary domain.
What Let me do is organise my
public_html something similar to this:
public_html/ www/ index.php ... sub1/ index.php ... some_library/ ...
By doing this, my content continues to be in
public_html only a part of it will likely be offered towards the client. I'm able to easily accomplish this for the subdomains, but it is the main domain that I am getting difficulties with.
I produced a
.htaccess file in
public_html using the following:
Options +SymLinksIfOwnerMatch # I am not permitted to make use of FollowSymLinks RewriteEngine on RewriteBase / RewriteCond % !^/www [NC] RewriteRule ^(.*)$ /www/$1 [L]
This works fairly well, however for some strange reason
www.example.com/stuff is converted right into a request for
www.example.com/www/stuff and therefore a 404 error is offered. It had been my knowning that unless of course an 'R' flag was specified, mod_rewrite was purely internal and so i can't realise why the request is produced as that suggests (in my experience a minimum of) redirection.
I believed this is a trivial problem to resolve as all I really wish to accomplish is forward all demands for that cause of
www.example.com to some subdirectory, but I have spent hrs trying to find solutions and they are not quite correct. I find it hard to believe I am alone to possess this problem.
I apologise if the question continues to be clarified on here before, Used to do search and trawl but could not locate an appropriate answer. Please could someone shed some light about this?
Finally handled to repair this myself. It works out that Apache takes note of folder configurations despite the
.htaccess file continues to be removed. In order I'd been having fun with this for such a long time, a number of my earlier attempts had completely polluted the config.
I solved it beginning with leaving comments all the
.htaccess file out aside from
RewriteEngine off which put everything (almost) normal again. I Quickly handled to obtain the preferred effect by writing the next config:
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ www/ [L] RewriteRule (.*) www/$1 [L] </IfModule>
Finally, I produced another
.htaccess file within the
www directory that contains:
<IfModule mod_rewrite.c> RewriteEngine off </IfModule>
Now everything appears to operate when i initially wanted. Shame it required such a long time to operate all of this out though!