Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
- If you use lighttpd as webserver the .htaccess-file won't do anything. But you can use mod_rewrite and a simple rewrite-rule to achieve the same functionality:
- Open the lighttpd-configuration-file (
/etc/lighttpd/lighttpd.conf
on debian). - Look for the server.modules-variable, usually at the top of the file.
- Make sure you have a line
"mod_rewrite",
uncommented. It should look similar to this:
server.modules = ( "mod_alias", "mod_accesslog", "mod_compress", "mod_rewrite", "mod_redirect", #"mod_evhost", # "mod_evasive" )
-
Add the rewrite rule:
url.rewrite-once = ( "^/sites/default/files/private/(.*)" => "/system/files/private/$1" )
Note: This may only work if you have clean URLs enabled (I use mod_magnet for that).
- Save the file and restart the web-server.
- Open the lighttpd-configuration-file (