Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a wordpress blog on a subdirectory which I've recently migrated from a .com to a ( to The problem is that many of the posts have images in them, and their hrefs still point to the old domain, and so they don't work with the current htaccess settings. The images point to, when I want them to point to So the thing I need to change in htaccess is '' to '' wherever it comes up.

Current htaccess looks like this (it's the standard URL-rewriting scheme for concrete5):

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(.*)$$1 [L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

# -- concrete5 urls end --

As you can see is redirected, but URLs inside documents don't seem to be rewritten.

Any help would be much appreciated!

share|improve this question
mod_rewrite doesn't change the contents of your HTML, javascript, and CSS resources. It modifies the request being processed, not the content being served. You'll want to look into fixing the links in your content. – Shane Madden Nov 16 '11 at 15:59
Do and resolve to the same host? So, is the above htaccess file for both of those hosts, or for just one of them, and if so which? – Andrew Schulman Nov 16 '11 at 16:00
@Andrew - yes they do. is parked on top of (it wasn't when the blog was first created, but now it is). – melat0nin Nov 16 '11 at 16:07

If you have access to the old host (sounds like you do from the comments), your rule should work when placed in the docroot of the old site:

RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(.*)$$1 [L,R=301,QSA]

BUT that only redirects old requests. You still need to update the site to reference the new domain if the old domain is to expire eventually.

share|improve this answer
Unfortunately that doesn't change requests in the HTML. I suspect it's not actually possible :( – melat0nin Jan 4 '12 at 9:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.