domain/pages/asd.php
I have a link in the form of I want to hide the pages folder. People need to write domain/asdf.php on the link and reach the file in the folder, how can I do it?
CodePudding user response:
Add the following to your .htaccess file
RewriteEngine on
RewriteRule ^pages/(. )$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (. ) /pages/$1 [END]
This will ensure users can only access the url by the new route only (/asd.php) and not via both (I.e /asd.php & /pages/asd.php).
