2

I have a drupal instance on a linux server located at

var/www/html

I created a indepent html file called index.html in the following directory

var/www/html/special_project/index.html

I am able to see "special_project/index.html" by typing

mysite/special_project/index.html

I want to include some javascript files located in special_project/script,

example:

<script type='text/javascript' src='script/my_script.js'></script>

however at this point the server has some rewite rule, loads the Drupal bootstrap and throws back a page not found error for the javascript.

Is there something I can put in .htaccess file to indicate to the server to prevent this behaviour?

EDIT

This is what virtual hosts looks like now:

<VirtualHost *:80>
    ServerName intranet.mysite.com
    DocumentRoot "/var/www/html"
</VirtualHost>

If I modified the following as Shane suggested, should it do the trick?

<VirtualHost *:80>

    Alias /special_project /var/www/html/special_project

    <Directory /var/www/html/special_project>
      Order allow,deny
      Allow from all
    </Directory>

    ServerName intranet.mysite.com
    DocumentRoot "/var/www/html"
</VirtualHost>

1 Answers1

0

Drupal's default .htaccess is a beast, I'd recommend avoiding the issue; use an Alias directive to load the non-Drupal content from outside of the Drupal docroot.

Alias /special-project /var/www/static/special-project
<Directory /var/www/static/special-project>
  Order allow,deny
  Allow from all
</Directory>

This needs to be configured in the Apache configuration, not an .htaccess file, so it won't work if you don't have access to that.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • I added additional config info above. Can I mix virtual host and directory attributes together like this? – ethan allan Jul 19 '13 at 22:31
  • @ethanallan The `Alias` and `` will work outside of the ``, but the best approach would be to put them inside of it, to avoid having the configuration apply to any other virtual hosts accidentally. – Shane Madden Jul 19 '13 at 22:32
  • made the change as suggested . restarted the server. updated my question above to reflect my canges.... however same error as before. :( – ethan allan Jul 19 '13 at 22:35
  • So the js file is located at `/var/www/static/special-project/script/my_script.js`, correct? And the client browser sends a request to `http://intranet.mysite.com/special_project/script/myscript.js` and gets a 404? – Shane Madden Jul 19 '13 at 22:42
  • OK. now working. silly syntax error! Thanks 100X – ethan allan Jul 19 '13 at 22:54
  • @ethanallan Great, glad to hear it! – Shane Madden Jul 19 '13 at 22:56