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


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 http://mydomain.com/ar 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
add comment

2 Answers

up vote 0 down vote accepted

Sorry, not enough reputation on this board to comment, but 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
add comment

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
add comment

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.