Dec 20 2009
Posted by Webmasters-central.com as Search engine Marketing
This method is used ONLY IF YOU HAVE few URLs. Otherwise it will be very difficult for you to update some hundreds of urls by this method.
If you want to change some hundreds and thousands of urls with underscrore to hyphenated urls, check this tutorial.
Here you will use redirect 301 method.
You need .htaccess file in your root directory.
Open your .htaccess file in your webhost panel.
Copy the following lines into it. Ofcourse change the paths of the files and domain name to yours.
RewriteEngine on
Redirect 301 /product_one.html http://www.yoursite.com/product-one/index.php
Redirect 301 /contact_us/index.html http://www.yoursite.com/contact-us/index.phpAbove is the simple way.
You can also achieve the same result with the following modrewrite rule too.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/product_one.html$ http://www.yoursite.com/product-one/index.php [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/contact_us/index.html$ http://www.yoursite.com/contact-us/index.php [R=301,L]Remember to keep the ^ and $ signs next to your defined urls.
.
One Response
Search engine optimization – hyphens or underscores? Htaccess modrewrite rule. | Internet marketing Blog
December 21st, 2009 at 2:27 am
1[...] If you have few urls with underscores to update use this simple method of 301 redirect. [...]
RSS feed for comments on this post · TrackBack URI
Leave a reply