Score:1

RewriteBase and Administer software updates permission not working

cn flag

User 1 is unable to run /update.php, with the error: In order to run update.php you need to either have "Administer software updates" permission or have set $settings['update_free_access'] in your settings.php.

If I set $settings['update_free_access'] to true, I can run the update.

I get this even on a default installation [Drupal 9.4.8]. It looks like it is down to the Apache configuration:

DocumentRoot "/_site"

_site contains the following:

  • vendor
  • web
  • .htaccess
  • composer.json & .lock

/_site/.htaccess has the following:

RewriteEngine on
RewriteRule (.*) web/$1 [L]

In /_site/web/.htaccess I have the default drupal .htaccess with the following:

RewriteBase /web

With this set up, the site works mostly as expected at least for the public facing side fo things, There are some admin things such as batch operations that end up trying to go to /web on complatetion and failing, but the task runs to completion, just the redirect does not.

If I change my DocumentRoot to: "/_site/web/" and comment out RewriteBase /web I have access to /update.php and it works as expected.

I have set this up as the live hosting environment will not allow me to set DocumentRoot "/_site/web/" only DocumentRoot "/_site"

What do I need to change to allow the update to run without modifying $settings['update_free_access']

EDIT: additional config:

in settings.php, I have the following

$base_url = 'http://domain.com/';

if (isset($GLOBALS['request']) and '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME')) {
 $GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.