I am stuck in times with htaccess - No previous solutions in stack appears that helped me to so I am writing a replacement. This is actually the problem:

I would like all of the demands to become investigated http://www.example.com/folder/public_html/ automatically and when the asked for resource does not exist for the reason that folder, the request ought to be routed to http://www.example.com/index.php

Example: I place a request http://www.example.com/example.php, so automatically, the server should consider /folder/public_html/example.php and when the file isn't there then it ought to be routed through the index file within the cause of the website i.e. /index.php?request=example.php

Help, I am badly stuck

Produce a .htaccess with this particular rule within the directory http://www.example.com/

RewriteEngine on
RewriteRule ^(.*)$ /folder/public_html/$1 [L]

Along with a .htaccess with this particular in http://www.example.com/folder/public_html/

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?request=$1 [R]

(Should you simply want to show /index.php?request=example.php but don't want the browser to redirect, use [L] rather than [R])


If you wish to redirect to /folder/public_html/file.php when the file is available, add wrinkles within the second .htaccess:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ $1 [R]

Automatically the file /folder/public_html/file.php is proven whether it is available due to the rewrite rule within the first .htaccess, however the browser does not redirect.