The admin setup a subdirectory /sites/default/files/resources and updated the docroot .htaccess to point to this subdirectory so that the domain www.example.com points to it. I do not have access to the docroot .htaccess

In the browser, www.example.com/resources shows www.example.com/sites/default/files/resources

What should I add in the subdirectory .htaccess such that URL shows www.example.com/resources and uses the index.html in /sites/default/files/resources/index.html?


RewriteCond %{HTTP_HOST} www.example\.com$ 
RewriteCond %{REQUEST_URI} !^/sites/default/files/resources/ 
RewriteRule ^(.*)$ /sites/default/files/resources/$1 [PT,L]
  • What is in the docroot .htaccess? That isn't the type of change that would usually be made with .htaccess Usually you would add a VirtualHost to Apache and set the DocumentRoot for that virtual host to /sites/default/files/resources to have the files served from that directory. Sep 17, 2023 at 14:03
  • DO NOT maintain your configuration in .htaccess files unless you really REALLY have to. It makes managing your site really difficult and impacts performance.
    – symcbean
    Sep 22, 2023 at 15:08

1 Answer 1


If you don't have access to the main .htaccess file in the document root (docroot) of your website and want to set up a specific rewrite rule for the /resources URL path to point to /sites/default/files/resources/index.html, you can create a separate .htaccess file in the /sites/default/files/resources/ directory. In this directory's .htaccess file, you can add the following rules:

Create or edit the .htaccess file in the /sites/default/files/resources/ directory.

Add the following directives to that .htaccess file:

RewriteEngine On
RewriteBase /resources/

# Redirect /resources to /sites/default/files/resources/index.html
RewriteRule ^$ /sites/default/files/resources/index.html [L]

# Handle other resources if needed (e.g., images, CSS, JavaScript)
# Add rules for your specific needs here

These rules will redirect requests to /resources to /sites/default/files/resources/index.html. You can also add additional rules to handle other resources like images, CSS, and JavaScript files if needed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.