Let's say I call www.expamle.com
in browser. That'll get the data from /
on my server.
But how can I get the data from /folder/
on my server but still able to call from www.expamle.com
and also remain www.expamle.com
as browser address?
Additionally e.g. www.expamle.com/my_file.php
should be called from /folder/my_file.php
on my server.
How can I do that with .htaccess
?
You can use the following rule :
RewriteEngine on
RewriteRule !^folder /folder%{REQUEST_URI} [L]
This will rewrite all requests including existing files and subfolders from your root to the /folder . If you dont want to rewrite your existing root files and folders, you can use this
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /folder%{REQUEST_URI} [L]
Try below rule too,
RewriteEngine On
RewriteRule ^(.*)$ /folder/$1 [QSA,L]