Changing underscores to hyphens using your .htaccess file:
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.
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.
Modrewrite rule:
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.
.








[...] If you have few urls with underscores to update use this simple method of 301 redirect. [...]