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.

Possible Duplicate:
.htaccess file?
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?

I am looking for exact code for creating .htaccess file used for redirect a simple static page.

Looking forward to positive replies.

Thank You

share|improve this question

migrated from stackoverflow.com Jun 24 '10 at 5:49

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Iain, Chris S Feb 17 '12 at 16:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer

It doesn't get much simpler than this:

RewriteEngine On
RewriteRule ^foo.html$ /bar.html [R=301]

The effect of this would be users who try to access foo.html getting redirected to bar.html (with the HTTP response code 301).

share|improve this answer
2  
Yes it does. Redirect permanent /foo.html /bar.html –  Ignacio Vazquez-Abrams Jun 22 '10 at 7:57
    
"much" redefined –  Lauri Lehtinen Jun 22 '10 at 8:15
add comment