[Solved] How to redirect index.php to root in htaccess? [closed]


You’d first redirect to pretty-url if the raw request matches:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /login\.php [NC]
RewriteRule ^login\.php$ /login/ [R=301,L,NC]

Now, you deal with the rewritten url to internally redirect to correct page:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^login/?$ /login.php [NC,L]

solved How to redirect index.php to root in htaccess? [closed]