Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have to manage a huge web site which has coded with absolute paths like:

<a href='http://www.samewebsite.net/anotherPage.cfm'>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 www.samewebsite.net 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="mywebsite.net/pageB.html">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

1 Answer 1

up vote 0 down vote accepted

Mod_rewrite will not change your HTML. You need an output filter http://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html

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

 
discard

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.