Remove/Redirect index.php from url to prevent duplicate urls
snippet in htaccess

Remove/Redirect index.php from url to prevent duplicate urls

user1965

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php[^/] /$1? [L,R=302,NC,NE]

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php(?:/(.*))?$ /$1$2? [L,R=302,NC,NE]