before this thread is marked as a "duplicate", or down-voted by someone eager.......kindly allow me to address my issue first :)
Despite having dozens of various solutions to this issue online, none seem to work for me.
I'm trying to hide a folder, so it does not display in my URL.
My domain name is : www.example.com
My login file is within the "PHP" folder.
So, the login URL is : www.example.com/PHP/login.php
I am trying to hide the "PHP", so the URL displays as :
www.example.com/login.php
I've copy-pasted several examples from this forum, but nothing seems to work.
I've tried this :
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/PHP/
RewriteRule ^(.*)$ /PHP/$1
or this.........
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/PHP
RewriteRule ^(.*)$ PHP/ $1
(i.e., I removed the trailing slashes)
Nothing works. The URL continues to load normally.
The only time I get an error is when I include the "[L]" at the end of the code :
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/PHP/
RewriteRule ^(.*)$ /PHP/ $1 [L]
Then, I get a "403" error..........which makes sense, seeing as the "[L]" prevents any further Re-write commands from executing. And I have a few of them in my HTACCESS file.
Here is my complete HTACCESS file :
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^/PHP/(.*)$ http://www.example.com/$1 [L,R=301]
#RewriteCond %{REQUEST_URI} !^PHP/
#RewriteRule ^(.*)$ PHP/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
(Note the two lines which are commented-out. )