So far we’ve learned that .htaccess can easily be used to make some tweaks over Apache Web Server’s configuration. Now we’re going to learn that how can we create SEO Friendly URL using .htaccess.
How to Create SEO Friendly URL using .htaccess
STEP 1: Login to your cPanel Account. Navigate to File Manage under Files section. Browse to public_html folder & open .htaccess on editor.
STEP 2: Let’s think you’ve got a dynamic URL like https://www.yourwebsite.com/products.php?keyval=25&keyval2=65 which you need to convert to a SEO Friendly URL. Well, write the codes below in your .htaccess file to perform this task
Options +FollowSymLinks RewriteEngine on RewriteCond %{QUERY_STRING} "keyval\=25&keyval2\=65$ [NC] RewriteRule ^products.php$ https://www.yourwebsite.com/household-products.php? [r=301]
Note: Don’t forget to put a (?) question mark at the end of the substitution URL you’ve created. Otherwise query string will be appended at the end of the substitution URL.
We hope this tutorial helps you find the perfect solution. If your like our tutorials, definitely you’ll love our support. All VernalWeb hosting plans include 24/7 support from our amazing inhouse support staff. Check out our web hosting plans and have your website migrated today!