How to make url SEO friendly?
The word Seo friendly itself describes the importance of making url seo friendly. Seo means search engine optimization.
When a website is developed, it is very necessary to take care of things which are user-friendly. Most of us want to develop a website that is easy to operate and the content is fruitful, same as that the url links that appear in the browser are very important, to make them easy to remember for users. Above all if your url are meaningless than the search engine won’t scrawl it in the search result and that will affect your ranking. Search Engine Optimization is a technique used in web publishing to increase web page visibility and traffic for a higher ranking in search engines and more readers.
suppose your url is www.example.com?id=123&name=john
This url seems to be difficult to remember, it has no meaning in it. When search engine scrawl for content it hits the url first when the url content matches the keywords than the website appear in search result.
What if this url is converted into seo friendly url like this www.example.com/name/john.html. this is easy to remember and it has its own meaning. One can easily understand that this page has information about the person whose name is john.
Once we have understood the importance of seo friendly url the question appear how we can make our url seo, right?
To make url one must have the basic knowledge of .htaccess. This is the main file which redirects the seo friendly url to ugly url and force the server to open the correct page of the url. This file works on regular expression. Which look like this…
For example:-
AddDefaultCharset utf-8 – This is default line to be written while using utf-8 characterst
Options +FollowSymlinks –Indexes -This is also default line of .htaccess
RewriteEngine on – This line is to tell the server to start rewrite rule
RewriteBase / – This is the base if you have a folder name than base will be /foldername/
# skip all files and directories from rewrite rules below – # is used for comment.
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ – [L]
RewriteRule ^authors/([^/]*)\.html$ main.php?authchar=$1 [QSA,L] – here author is just an extra name added in the url.
For example:- www.example.com/main.php?authchar=1
This can be rewritten as:- www.example.com/author/authchar.html
For this you have to write the above code in .htacccess and the rewritten url (www.example.com/author/authchar.html)in your code in place of this code…
<a href =”main.php?authchar=1″>.
You must learn regular expression if you have more than one parameter in you url. You have to use same number of regular expression as your parameter. If 1 parameter than 1 if 2 than 2 and so on.
Hope you like this post.