Forum Moderators: phranque
Yes that is correct everythingWe need a few more verbs.
RewriteEngine On
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L] i add this rules in to my .htaccess fileThat's one way. Another--there are many possible variations--is
RewriteCond %{REQUEST_URI} ^/((?:\w+/)*)index\.php
RewriteRule index\.php https://www.example.com/%1 [R=301,NS,L]
I recommend the NS flag (“no subrequest”) because then the server simply doesn't have to evaluate conditions when it's an internal request, in this case the one that serves up your directory index file. This, in turn, means that THE_REQUEST isn’t needed in the condition.