I feel like this should be superbly simple, but I've been coming back to this issue over and over for a couple of weeks now and I'm not getting anywhere. I've got drupal installed in a subdirectory of a site, and the site as a whole is in version control, so that it lives at many different domains:

* http://example.local/drupal
* http://stagign.example.com/drupal
* http://www.example.com/drupal

My favicon lives at http://www.example.com/graphics/favicion.ico and I want to point drupal to it, but drupal doesn't believe me when I use absolute paths to images. The favicon keeps trying to resolve to http://www.example.com/drupal//graphics/favicion.ico -- similarly, I plugged in absolute URLs for my primary navigation and drupal is hijacking them.

/news/ becomes /drupal//news/

I would really like to crack this at least for the primary navigation, but I'm seriously stuck.

Comments

amanda’s picture

There are some good writeups of how to use rewrite rules in .htaccess to fix this

http://drupal.org/node/175427
http://drupal.org/node/135206
http://drupal.org/node/144643

amanda’s picture

According to Apache's docs, this seems like it ought to work but doesn't:

RewriteRule ^/drupal//(.*) /$1 [L]

The idea was to redirect any urls that point to /drupal//foo to /foo with that second slash a telltale sign that I was aiming for http://example.com/foo

amanda’s picture

I got as far as ...

   RewriteCond %{REQUEST_URI} ^/drupal//.*
   RewriteRule (.*) /$1 [L]

which does the trick content wise, the pages load properly. Whew!

Problem is, um, er, uh, [shuffle of feet], that isn't quite what I wanted. Now what I've got is that http://example.com/drupal//foo loads the contents of http://example.com/foo rather than redirecting to http://example.com/foo. The URL still reads http://example.com/drupal//foo. The "Page not Found" errors are gone (sweet), so this will work if I can't iron out the rest, but it still isn't ideal.

Turns out that the last step is super easy.

   RewriteCond %{REQUEST_URI} ^/drupal//.*
   RewriteRule (.*) /$1 [L,R]

the [R] part redirects everything. Whew!

This I could not have done without the help of the drupal support forum.