After updating the module to the latest version and redeploying the htaccess file, it contains a syntax error.

Steps te reproduce:

- Install version 2.4 of the module and deploy the htaccess file.
- Update htaccess to 2.5
- Deploy the htaccess file again
(I used Drush: drusk up; drush ht [profile])

Notice that the site throws an error 500.

The reason; line 11 contains +FollowSymLinks, which should be Options +FollowSymLink. I have not pinpointed the cause of this; perhaps saving the profile again would solve it. But just dropping this here to help others who might ruin into the same problem/

Comments

Neograph734 created an issue. See original summary.

jibus’s picture

Status: Active » Needs review
StatusFileSize
new733 bytes

This patch should do the trick, but you'll have to recreate your htaccess again.

neograph734’s picture

I have hotfixed it for now, will try the patch in an hour or so. Thanks for the fast response!

neograph734’s picture

That did not solve it..

you'll have to recreate your htaccess again

Or did you mean create a new profile? I only redeployed it.

I just had another (better) look at my .htaccess file:

#
# 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)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  Order allow,deny
</FilesMatch>

+FollowSymLinks

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

# Follow symbolic links in this directory.
Options 

# Make Drupal handle any 404 errors.
# ...

Aligning that with the template file:"

#
# Apache/PHP/Drupal settings:
#
%%%rules_before%%%

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  Order allow,deny
</FilesMatch>

%%%prevent_txt%%%

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

# Follow symbolic links in this directory.
Options %%%symbolic_links%%%

# Make Drupal handle any 404 errors.
# ...

So it seems the +FollowSymLinks is placed at the %%%prevent_txt%%%position.

Almost like all values are shifted in the replacements... (I did notice that $prevent_txt_rules is only defined if $prevent_txt_config is TRUE, so there can be an undefined variable in the replacements. Could that be the cause?)

neograph734’s picture

Update, yup that did it. The undefined variable was skipped and the whole replacement array shifted.

Making sure that $prevent_txt_rules is always defined:

  $prevent_txt_rules = '';
  if($prevent_txt_config){
    $prevent_txt_rules = '# Prevent core text files from being read via the web.' . PHP_EOL;
    $prevent_txt_rules .= '<FilesMatch (^COPYRIGHT|CHANGELOG|INSTALL.mysql|INSTALL.pgsql|INSTALL.sqlite|INSTALL|LICENSE|MAINTAINERS|README|UPGRADE).*\.txt$">' . PHP_EOL;
    $prevent_txt_rules .= 'Order allow,deny' . PHP_EOL;
    $prevent_txt_rules .= '</FilesMatch>' . PHP_EOL;
  }

Recreating the profile and deploying it made everything show up again.

UPDATE: Your patch is not required as that now results in Options Options +FollowSymLinks.

jibus’s picture

Ok, i see now.

The value is not properly replaced in the default htaccess config.

The attached patch fixed this, but you'll have to recreate your profil (not very conveniant tough..).

jibus’s picture

Reroll patch according to #5

neograph734’s picture

@Jibus, did you upload the wrong file? They are identical ;)

jibus’s picture

Wrong file. This patch should be ok

neograph734’s picture

Yes, that seems to do it. It appeared I was able to re-deploy my old profile now without issues.

I'll check one other site to be sure, but I guess this did it.

neograph734’s picture

Status: Needs review » Reviewed & tested by the community

Confirming this is fixed. I have a follow-up though... #2868596: Protect Core text files setting is not persistent.

  • Jibus committed 4bf9cdb on 7.x-2.x
    Issue #2868555 by Neograph734: Error 500 after latert update
    
jibus’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for confirming this. Committed against 7.x-2.x

  • Jibus committed 4bf9cdb on 8.x-1.x
    Issue #2868555 by Neograph734: Error 500 after latert update
    

  • Jibus committed 4bf9cdb on 8.x-2.x
    Issue #2868555 by Neograph734: Error 500 after latert update
    

Status: Fixed » Closed (fixed)

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