-2

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

How to create .htaccess file for 301 permanent redirect. I am looking for exact code that we would put in the file.

Looking forward to hear from you all.

Thanks in advance.

  • I suggest Googling before searching here: http://www.google.com/search?q=How+to+create+.htaccess+file+for+301+permanent+redirect&ie=utf-8&oe=utf-8&aq=t&client=firefox-a&rlz=1R1MOZA_en___US333 – Kerry Jones Jun 17 '10 at 06:41

2 Answers2

1

This look like it.

http://en.wikipedia.org/wiki/URL_redirection#Using_.htaccess_for_redirection

Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html

For Apache after around version 2.2.14

huggie
  • 123
  • 5
-2

If you don't have a .htaccess file (for instance, on a Windows server) it's possible to redirect individual html pages using a meta tag:

<meta http-equiv="refresh" content="0;url=http://www.example.com/newpage">

This goes in the section along with the other meta tags. The content="0; tells the browser to redirect as sson as the page loads (this can be set to delay for a number of seconds), and the rest of the tag is the URL of the new page.

This isn't the best solution, since it has to be put into every page, and dynamic pages (eg php pages) have better ways to do this.