I am having a subfolder that has my index file. But normally any hosting service looks for the index file after inputting the domain name. Is there a way for me to configure the root file to go to the subfolder and then look for the index file in it?
CodePudding user response:
Create a file (.htaccess) in the root directory of your site and add the bellow code to redirect you to the SubFoler.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) SubFolder/$1 [L]
</IfModule>
if you want to remove the SubFolder name from url. create other (.htaccess) file inside the SubFolder and add bellow lines.
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteBase /SubFolder
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
</IfModule>