Having issues editing my .htaccess file to remove both the index file along with file extensions.
Example folder structure below:
_public_html
__about
___index.php
___contact-us
____index.php
__information
___index.php
___example-page.php
My idea is to rewrite the index.php in a directory to the root of the folder that it is located in (NOT THE ROOT DIRECTORY). Such as:
http://www.domain.com/about/index.php to http://www.domain.com/about/
Also, I would like to remove the .php extensions from other pages that I have in that folder. Such as:
http://www.domain.com/information/example-page.php to http://www.domain.com/example-page
Current .htaccess Rewrite below:
# DISABLE Directory Browsing
Options All -Indexes
# SET Canonical URL and Remove index.php
RewriteEngine on
RewriteRule ^([a-z]+/)?index\\.php$ http://www.domain.com/$1 [R=301,L]
RewriteRule ^(sub-directory-one/|sub-directory-two/)?index\\.php$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www|subdomain)\\.domain\\.com [NC]
RewriteRule .? http://www.domain.com%{REQUEST_URI} [R=301,L]
The line below was added in because I was having issues with Rewriting the index.php file in folders that had hyphens in the name to separate words.
RewriteRule ^(sub-directory-one/|sub-directory-two/)?index\\.php$ http://www.domain.com/$1 [R=301,L]
What do I add to this or change so that I can get the correct result? One line of code I was using was causing a 404 error when trying to redirect a directory with an index.php file in it.
Thanks in advance!