logo

To remove index.php from URL in Drupal 8

16
August

To remove index.php from URL in Drupal 8
By: Anonymous | Published On: Mon, 08/16/2021 - 13:49

By default adding /index.php/ in URL so how to remove index.php from URLs in Drupal 8

I have added the following code in .htaccess file then the issue has been resolved

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

 

Other method you can try to stop indexing this type of URLs in Google or other search engine

Add the following code in robots.txt

Disallow: /index.php/*

Need Help ?