-1

Using htaccess how to change the PHP website default home page ie index.php file from root folder ie "html" to sub folder(say it 'subfolder') but site should still work as before ie the home page will be from 'subfolder' but other pages will still using same old root "html" folder.

NOTE :

  • Website have SSL ie (https)

  • Home page Browser URL should always be https://www.mywebsite.com/

  • root folder is "html".

  • The directory path of "subfolder" is "html/subfolder", this folder only have only one file ie 'index.php'

  • So there should be no change in any page URL (including home page).

  • NO Redirect

1 Answer 1

1

As per Apache document https://httpd.apache.org/docs/2.4/mod/mod_dir.html, I tried

DirectoryIndex subfolder/index.php

So the Updated root folder .htaccess code is

<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteBase /app/ #--------- DirectoryIndex subfolder/index.php #--------- RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R=301,L] RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com$ [NC] RewriteCond %{HTTPS}s ^on(s)|off RewriteRule ^(.*)$ http%1://www.mywebsite.com/$1 [R=301,QSA,L] RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] RewriteRule ^(.*)&(.*)$ $1__-__$2 [N] 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.