Javascript not loading when .htaccess rewriting used
| Project: | Asset |
| Version: | 5.x-1.0 |
| Component: | Asset Bonus |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
I have my site set up with Drupal (5.14) installed in /drupal instead of at the site root, and I'm using a .htaccess RewriteRule to make it appear to users to be at the site root (as described in this handbook page). I added an asset (a .swf movie) and used Asset Bonus to get the inline player. But the player doesn't load, apparently because the JavaScript is loaded using a path relative to the site root:
<script type="text/javascript" src="/sites/all/modules/asset/asset_bonus/swfobject/swfobject.js"></script>
The src in this case should either be "/drupal/sites/all/modules/asset/asset_bonus/swfobject/swfobject.js" (the actual server path) or "http://example.com//sites/all/modules/asset/asset_bonus/swfobject/swfobject.js" (so my .htaccess will rewrite it to the actual server path). I don't think my .htaccess could rewrite the "/sites/..." version to "/drupal/sites/...", but I'd love to be wrong about that.
I've worked around this by copying the asset_bonus directory to the location output by the module (/sites/....) and everything works, so this isn't currently more of an annoyance and a suggestion to anyone else who ends up with this problem.
Perhaps this is related to #254346: Not using drupal_add_js to add javascript?
