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

There is many questions discussing rewrite mod problems i have read them and none solved my unique problem, i already done 3 hour of research to solve it and still stuck.

i want to rewrite links in a source code retrieved from remote site through file get contents php function,

when i get the source code the link structure is

<a href='javascript:openWindow("index1.php?option=com_lsh&view=lsh&event_id=148730&tv_id=850&tid=34143&channel=0&tmpl=component&layout=popup&Itemid=335","735","770")'  >Link#1</a>

i want to rewrite to

<a href='javascript:openWindow("","735","770")'  >Link#1</a>

after research i thought that rewite mod will do the trick and tried the put the code below in my htaccess file

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index1\.php?option - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule  http://remotesite/index1.php?option [L]

but it give me internal server error what i am doing wrong here? is there is any other way to rewrite the link structure the way described above?

share|improve this question

You can't rewrite DOM objects, apache's mod_rewrite rewrites requests, not DOM. The correct place for you to achieve whatever you're trying to do is at your php script which get file content.

share|improve this answer
Mr Marcel thank you for pointing me but do you hvae any ideas how to acheive this in my php code – user2330147 May 1 '13 at 17:29
You should place a question at StackOverflow about this. – Marcel May 6 '13 at 18:11

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.