Hi guys - I'm using Provision as currently installed by the head version of Aegir from the last week - I don't see version numbers in anything under ~aegir/.drush/provision, unfortunately.

Anyways, this is the last 15 lines or so of a given platform config file created by provision, as found under ~aegir/config/platform.d:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

<IfModule mod_rewrite.c>
  # allow files to be accessed without /sites/fqdn/
  RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>

# Do not read the platform's .htaccess
AllowOverride none
</Directory>

Note the RewriteRule for the /files alias occurs after the main drupal RewriteRule - this results in the rule being ignored.

I can it's being placed there by provision_drupal_provision_apache_dir_config() in verify.provision.inc, but my Drupal-fu's not quite good enough yet to see what's calling that and submit a patch.

CommentFileSizeAuthor
#3 772616.patch1.36 KBmig5

Comments

benkant’s picture

I can confirm this problem exists in 0.4a7

I even tried adding:

  RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]

to config/platform.d/platform_n.conf inside the

<IfModule mod_rewrite.c>

block... still no dice. Any ideas?

Anonymous’s picture

The L flag in the default .htaccess block causes the entry to be ignored. We used to stick it in the start of the IfModule block just under REwriteEngine On for this purpose.

Need to try and insert it into that block programatically, or (easier) perhaps just stick our block at the *start* of the config and read in the .htaccess after that.

Anonymous’s picture

Status: Active » Needs work
StatusFileSize
new1.36 KB

OK, here's a hotfix patch for this that will work

But it's a little ugly, we should not have multiple IfModules all over the place in the config that are calling RewriteEngine On multiple times (it doesn't break anything, but it's not nice)

We really need to make our own injections into the .htaccess be more modular, i.e have a 'provision_apache_rewrite_config' hook that will bundle them all up and stick them in the one grouping in the config.

proindustries’s picture

Yep, verified that'll work for now...thx!

ac’s picture

The symptoms of this bug are still present in ALPHA8. Not sure if they stem from the same code issue as it seems the code has been patched.

ac’s picture

Status: Needs work » Active

changing status as this is broken in ALPHA8.

Here is a copy of a platform.conf file:

<Directory /var/aegir/platforms/PRESSFLOW-6-16-77-CLIENTS>
    Order allow,deny
    Allow from all
# Extra configuration from modules:
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule sites/%{SERVER_NAME}/files/backup_migrate - [F]
  RewriteRule files/backup_migrate - [F]
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine on
  # allow files to be accessed without /sites/fqdn/
  RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>
#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$$
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
  # There is no end quote below, for compatibility with Apache 1.3.
  ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>
# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  <FilesMatch \.php$>
    # Do not allow PHP scripts to be cached unless they explicitly send cache
    # headers themselves. Otherwise all scripts would have to overwrite the
    # headers set by mod_expires if they want another caching behavior. This may
    # fail if an error occurs early in the bootstrap process, and it may cause
    # problems if a non-Drupal PHP file is installed in a subdirectory.
    ExpiresActive Off
  </FilesMatch>
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

# Do not read the platform's .htaccess
AllowOverride none
</Directory>

ac’s picture

Status: Active » Fixed

Arg this was the result of upgrading from an older aegir instance where the aegir vhost files were included using a line in apache.conf. The new method of symlinking from /etc/apache2/conf.d hadn't been included so no platform apache directives were loaded.

This issue seems to be fixed in the new alpha so I am marking it closed. Please reopen if you find an issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 71ada1b on debian, dev-dns, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, prod-koumbit, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x by mig5:
    Fix for #772616, include the rewrite above the default drupal one. Also...