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 have this rewrite rule

RewriteRule ^ar$       /index2.html

but i need to keep the url in the address bar unchanged after the redirect.
ie. if the user typed i need to redirect him to /index2.html but keep the url as is.
any idea of how to do so??
Thanks for your help

share|improve this question
up vote 1 down vote accepted

What Lairsdragon said is correct. However, if you have more than one rewrite rule in your config, you will want to add the [L] flag to the end in order to prevent other rules from being applied.

share|improve this answer

The Pattern in the RewriteRule is wrong. A

RewriteRule ^/ar$       /index2.html

should to exactly what you want: It rewrites the /ar to index2.html without telling the web browser about the redirection.

share|improve this answer
ok... what shall it be... i tried too many flags like L,NC,R=301, R and too many others, but didn't get it as i want... so what shall it be?? – Alaa Alomari Mar 30 '11 at 11:37
No flags at all :-) Just tried on my webserver works like a charm. – Lairsdragon Mar 30 '11 at 11:39
this is what i know!! it is supposed to keep the url unchanged if you didn't provide any rewrite flag!! but this didn't work with me!! any idea?? – Alaa Alomari Mar 30 '11 at 11:57
Could it be that you dont really redirect to a static file? If another apache module is involved like mod_proxy, mod_jk etc this ma lead to an external rewrite via HTTP code 302 – Lairsdragon Mar 30 '11 at 12:16
@Alaa If you remove that rule completely do you still get the redirect? If so you probably have another rule or directive that is being applied first. – matthew Mar 30 '11 at 21:22

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.