Posted By

zachharkey on 03/21/09


modrewrite htaccess drupal

Versions (?)

Rewrite Drupal's File system paths to remove redundant sites/

 / Published in: Apache


My original post languished for years before someone pointed out a possible solution here.

The following user-submitted code may be useful in redirecting URLs for the /files directory to the /sites/ directory. The following code is added to the [drupal_root]/files/.htaccess file. Note, this directory is not part of the default Drupal distribution and must be added.

  1. RewriteEngine On
  2. RewriteCond %{REQUEST_FILENAME} !-f
  3. RewriteCond %{REQUEST_FILENAME} !-d
  4. RewriteRule ^(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]

Report this snippet  

You need to login to post a comment.