views:

475

answers:

1

I guess I don't understand RewriteBase. I have a (drupal) site built on my dev server and everything works perfectly. I created a fake URL for it in my own apache and hosts file, so I get to my local version with "local-examplesite.com".

Eventually it will live at www.examplesite.com, but I want to put up a draft with a temp URL at my hosting company like so: 123.45.67.89/~examplesite . I set the RewriteBase in .htaccess to /~examplesite .

All the pages work fine, and all the navigation links go to the right places. But none of my images work! They are of the format src="/sites/default/images/blah.png", and so the tags are getting rendered as src="http://123.45.67.89/sites/default/images/blah.png", instead of src="http://123.45.67.89/~examplesite/sites/default/images/blah.png".

Is there any way I can get the site to point to right images? I thought that's what rewritebase was for, but after reading up a bit I guess it is for URLs only (the ones that get rewritten, natch).

A: 

I struggled with this myself until I came upon the realization that my understanding of Rewrite rules was wrong. Rewrite rules are for rewriting URLs only. Apache does not apply them to the contents of HTTP requests. The tag is in the HTTP request.

The solution to my problem was to apply a shell sed script to perform regex substitution on the old paths.

Paul