ow to implement the 301 Redirect 1. To create a .htaccess file, open notepad, name and save the file as .htaccess (there is no extension). 2. If you already have a .htaccess file on your server, download it to your desktop for editing. 3. Place this code in your .htaccess file: redirect 301 /old/old.htm http://www.you.com/new.htm 4. If the .htaccess file already has lines of code in it, skip a line, then add the above code. 5. Save the .htaccess file 6. Upload this file to the root folder of your server. 7. Test it by typing in the old address to the page you've changed. You should be immediately taken to the new location.
301 redirect code syntex search in google and put in . htacces file , now upload this file in your rood file.
First of all, you'll need to download the .htaccess file in the root directory of where all your web pages are stored. If there is no .htaccess file there, you can create one with Notepad or a similar application. Make sure when you name the file that you remember to put the "." at the beginning of the file name. This file has no tail extension. If there is a .htaccess file already in existence with lines of code present, be very careful not to change any existing line unless you are familiar with the functions of the file. Scroll down past all the existing code, leave a line space, then create a new line that follows this example: redirect 301 /old/old.htm http://www.you.com/new.htm It's as easy as that. Save the file, upload it back into your web and test it out by typing in the old address to the page you've changed. You should be instantly and seamlessly transported to the new location. Notes: Be sure not to add "http://www" to the first part of the statement - just put the path from the top level of your site to the page. Also ensure that you leave a single space between these elements: redirect 301 (the instruction that the page has moved) /old/old.htm (the original folder path and file name) http://www.you.com/new.htm (new path and file name) in case of dynamic pages: A dynamic page is one generated by a database driven application, such as blog or forum software. A file name is appended by a query string, looking something like this: http://www.example.com/page.php?id=13 Where a query string is used, the 301 redirect solution for static pages above will not work; you'll need to use a rewrite solution. Using the page.php?id=13 example, here's what you'll need to use in your htaccess file: RewriteEngine on RewriteCond %{QUERY_STRING} ^id=13$ RewriteRule ^/page.php$ http://www.example.com/newname.htm? [L,R=301] In the example above the id=13 should be replaced with the query string of the page you wish to redirect and the page.php with the name of your file prior to the query string. A more powerful set of directives for manipulating URLs is contained in the Apache mod_rewrite module, especially useful when changing domain names and/or folder names containing large numbers of files. Read our basic tutorial on the apache mod_rewrite module.