I have a strange issue: I have a drupal 8 instance on a subfolder in /var/www, I have enabled mod-rewrite in apache, I changed the apache.config file as in this post and the clean urls are working if I navigate directly to /drupal/admin for example.

I also added the RewriteBase /drupal in my .htaccess file.

The problem is that any link generated by drupal still contains the /drupal/index.php/ part and I don't know how to get rid of that /index.php part.

I worked with Drupal 7 since it was launched but I never had this problem.

Is there a setting somewhere in db or in the config file where I should 'tell' drupal to use clean urls?

My server runs Apache 2.4.7 and PHP 5.5.

Thank you.


2 Answers 2


If you didn't append /index.php to the base URL (e.g. setting $base_url to http://example.com/index.php, in the settings.php file), then the rewrite rules in the Apache configuration files are wrongly adding /index.php to your links.
Check both of them, and you should find what is causing the wrong behavior.

  • Hi i have the same problem and checked the settings.php file there is nothing which sets base_url path. So maybe its a problem of my host? I wonder because some links are standard without the "index.php" and some are with. How is this possible?
    – lolhonk
    Sep 24, 2016 at 10:17
  • To me the clean URLs which are autodetected in drupal 8 in every request as seen [here]: drupal.org/node/1659580 gave me the same impression ...
    – GiorgosK
    Feb 24, 2017 at 18:44

I have had the same or similar problem with Drupal 10.1.x when logged in when running PHP (8.1.x) as a FPM application on Apache 2.2. i.e. index.php being prepended to url path despite mod_rewrite being enabled. For me I was able to modify the .htaccess file and then after restarting the web service and clearing drupal cache, sometimes twice, with the following changed in my .htaccess.

- RewriteCond %{REQUEST_URI} !=/favicon.ico
+ RewriteCond %{REQUEST_URI} "!=/favicon.ico"

I have posted an issue here for this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.