i am at my wit's end with this one.
I have a .htacces file which i'm using to redirect certain roots to files.
For example:
example.com/
to example.com/home.php
example.com/subdir/
to example.com/subdir/home.php
This is working great for my subdir redirect but my root redirect to home.php throws up a 404 error and then redirects me to my site's 404 eorr page.
This is my .htaccess file (i've left everything in just incase another rule is throwing things off).
RewriteEngine off
RewriteEngine on
AddDefaultCharset utf-8
#Alter the default time zone for the site
SetEnv TZ Europe/London
#set the RewriteBase
RewriteBase /
#Redirect from root to home.php
RewriteCond %{REQUEST_URI} ^\/?$
RewriteRule (\/)?$ home.php [L]
#Redirect from /subdir to /subdir/home.php
RewriteCond %{REQUEST_URI} ^/subdir\/?$
RewriteRule ^subdir(\/)?$ subdir/home.php [L]
#Removing .php from the end of file paths
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L,QSA]
#Forcing https://
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*)$ [NC]
RewriteRule (.*) https://%1%{REQUEST_URI}
#Redirect to 404 error page
ErrorDocument 404 /page_not_found.php
RewriteCond %{HTTP_HOST} ^(www\.)?example.com/(.*)$
RewriteRule ^$ "https://example.com/page_not_found.php" [R=301]
What should i be doing to get example.com and example.com/ to redirect to example.com/home.php?
Try this in after the comments #Removing .php from the end of file paths
Do comment your own code and paste this. It might help you
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]