- 🇮🇹Italy senzaesclusiva
Hello @amavi and @thomaswalther, sorry to reopen the post.
I have since a few days, in an Apache platform, the same problem of index.php in the URLs, which also branches to all the menu links.
For more information, I found "index.php" matches in only two db tables: 'local_location (63 records)' and "batch (1 record)".The local version of the site does not have this behavior.
I would like to try your code to get rid of the problem, but in Drupal 9.4.8 I don't have "RewriteEngine" in settings.php as per your indication, while I have it in the .htaccess file (RewriteEngine on)
How can I do it...can I still copy it into settings.php?Thank you very much if you can give me any pointers
- leymannx Berlin
To fix this, install the Redirect module → , go to
/admin/config/search/redirect/settings
and activate "Enforce clean and canonical URLs". - leymannx Berlin
The fix actually is really bad if you rely on multiple aliases for one entity. 😬
Nonetheless the bug suddenly disappeared after I enabled that option and then disabled it again, flush cache. 🧐
- 🇮🇹Italy senzaesclusiva
You are correct. I installed and enabled the Redirect module with the settings you reported and the index.php string disappeared.
Later, after doing the update to D 9.5.4 and then D 9.5.5 I first disabled the feature and then uninstalled the module, and now index.php no longer appears.I am still left with, in the tables 'locales_location' and 'batch' the old references with the advice 'Version of Drupal where the location was found'.
I'm trying to figure out if I can empty these two tables without creating any operational problems.
Thank you very much for your advice We solved this issue installing and configuring the HTTPS and WWW Redirect module https://www.drupal.org/project/httpswww →
In addition to solving the index.php problem, it also redirects www and http which allows you to always have one session open and not several for registered users.- 🇮🇹Italy senzaesclusiva
Hi @Jorgefernandes,
thanks for your suggestion. At the moment the problem seems to be gone after an update, but this module looks interesting for other functions as well.
Thanks again - 🇪🇪Estonia veskimees
It's still here! & #5 seems to work.
Drupal 9.5.9, PHP 8.0.28, DB 10.6.13-MariaD8-log
From D7 upgraded site, some 2000 nodes, lot of different modules.
Had different pictures in different tabs in same browser window.
There was pseudomenu made with View, in v.1 headings were w 'index.pxp' (and some messed up), in v.2 without. - 🇩🇪Germany mkalkbrenner 🇩🇪
We're also affected by this issue but want to avoid additional modules as workaround. Therefore, we adjusted .htaccess to let apache perform the redirect.
I think we should raise the priority of this issue. Even if drupal is able to deliver
/index.php/node/27
, all requests to/index.php/sites/default/files/*
return 404 Page not found! - 🇩🇪Germany mkalkbrenner 🇩🇪
Here's a patch that could be included in composer patches.
- last update
about 1 year ago 30,334 pass, 1 fail - 🇦🇹Austria drupalfan2
Added patch #57 to composer.json
and this helped me to solve the problem at downloading files from /sites/default/files folder (page not found error for urls like /index.php/sites/default/files/filex.pdf). Hi :)
At my .htaacces the last Line is red with Visual Studio Code:
# Pass all requests not referring directly to files in the filesystem to
# index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]So I put favicon Line in comment and Line with index.php (last line) become normaly, good Idea???
# Pass all requests not referring directly to files in the filesystem to
# index.php.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]- 🇬🇧United Kingdom 2dareis2do
I have had this issue with a couple of sites now. i.e. index.php showing on Plesk web-server with being served with both Apache and Nginx. As soon as redirect module is enabled the 'index.php' part of the url goes away.
Erratic.
#57 looks interesting.
(On plesk, favicon.ico is also used/loaded from admin ui when available now. see https://docs.plesk.com/release-notes/obsidian/change-log/#plesk-18057)
- First commit to issue fork.
- 🇺🇸United States ddavisboxleitner
I have come up with an initial and unsophisticated solution to the problem. In the UrlGenerator class (core/lib/Drupal/Core/Routing/UrlGenerator.php).
On line 364 we see the following:
$base_url = $this->context->getBaseUrl();
When a user requests the homepage using 'www.yoursite.com/index.php' we are getting '/index.php' as the base URL. This is a special case where we are on the homepage and we can safely disregard this base URL. The unsophisticated solution is to simply empty this $base_url variable.
if ($base_url === '/index.php') { $base_url = ''; }
There may be a smarter way to handle this special case. For now, this code will prevent the bug from appearing.
- Merge request !7995Draft: Resolve #3050261 "Index.php randomly appears" → (Open) created by ddavisboxleitner
I put this on my Robot.txt :
/index.php/*
And on the module "Path Auto" I check/Uncheck the option User and problem seem stop.... Strange...
- 🇫🇷France floown
Hello,
I have randomly the same problem.
Will there be a backport to Drupal 10 latest?
Regards
- 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
@ddavisboxleitner I don't think that solution would work if the Drupal site is not at the root of the host, for example,
www.yoursite.com/SITE/PATH/index.php
.