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?

docroot/.htaccess 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 at 14:03
  • in docroot/.htaccess # Direct a domain to a static HTML website contained in the file system RewriteCond %{HTTP_HOST} www.example\.com$ RewriteCond %{REQUEST_URI} !^/sites/default/files/resources/ RewriteRule ^(.*)$ /sites/default/files/resources/$1 [PT,L]
    – TPI
    Sep 20 at 15:21
  • 1
    Rather than adding details in comments, please edit your question to add requested information. You can then comment saying that you have done so. Code cannot be formatted well in comments. In addition, comments here may get hidden by "show more comments" or could be deleted without notice. Editing updates into your question ensures that they don't get lost and that everybody who wants to answer the question sees them. Sep 20 at 17:28
  • 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


Your Answer

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

Browse other questions tagged or ask your own question.