Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have to manage a huge web site which has coded with absolute paths like:

<a href=''>link to another page in the site.</a>

Now, as I previously said, the web site has many pages and I'm not paid for changing manually all the absolute URLs into relatives. Someone suggested me to try use the mod_rewrite Apache to get rid of them. I checked Apache docs and tried this:

RewriteEngine On
RewriteRule localhost

but it doesn't work nor in .htaccess file nor in httpd.conf inside the VirtualHost directive. I guess it's a matter of regexpressions, but I'm not sure of it. How can i solve this?

Thank you.

share|improve this question
Can you explain what exactly you are typing into your address bar, and what you EXPECT to happen? Your question is very obscure. – Andrew M. Nov 19 '10 at 13:03
The problem is that all of the links in the website are hardcoded with absolute Internet path. So, let's say that you are in pageA.html and you want to go to pageB.html by clicking an hyperref, normally you'd type: <a href="pageB.html">page two</a>, n this site indeed: <a href="">page two</a>. I'd like that Apache forward these request into: <a href="localhost/pageB.html">page two</a>. – IssamTP Nov 19 '10 at 15:27
up vote 0 down vote accepted

Mod_rewrite will not change your HTML. You need an output filter

I'm not paid for changing manually all the absolute URLs into relatives.

Manually? Why not write a simple script?

share|improve this answer

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.