How to create SEO friendly url
SEO friendly URL is recommended for any website which wants to be indexed and wants its presence in search results. Searchengine mostly index the static URL. It will avoid the URL which has lot of query strings. Almost all websites generate content dynamically then how could the URL be static. That is the job of the programmer.
Another reason of using SEO friendly URL is more readability or visibility. It is easy to remember, easy to bookmark.
Consider an example of a blog, which delivers article based on request. When user clicks the link, complete content of the article will be displayed. The URL could be something similar to below
http://blog.com/article/101/hello-world
Let understand the URL,
blog.com - Name of the site
article - The category of the blog. Blog may have many categories like News, Comments etc.
101 - It the database primary key identifier of the article.
hello-world - short description to represent the article.
Most of the websites follow similar kind of technique. Each component in the URL will have some information like what section and subsection the content belongs to. URL should have unique identifier to retrieve the content from the data store. In this example it is primary key in the database.
There are some tools available to achieve it. Developer could use mod_rewrite kind of module to rewrite or transform the dynamic URL to static URL. mod_rewrite is for Apache, similar kind of module is available for other web servers.
Actual: http://blog.com?section=article&id=101
Most of the web framework provides an option to call corresponding handler based on request. Java Struts2 framework has similar kind of functionality. Another better option to control programatically.
After rewrite: http://blog.com/article/101/hello-world
Struts.xml will have below information. When there is any request for article, the method viewArticle will be invoked. articleID and articleName are member variables of the class articleAction. On request, the framework will break the URL components and set the member variables and invoke the action method.
< action name="article/*" class="com.company.articleAction"
method="viewArticle" >
Most of the framework do provide similar kind of functionality. This is the easiest way to achieve the SEO friendly URL.
< param name="articleID">{1}</param>
< param name="articleName">{2}</param>
< result>/article.jsp</result>
</action>
comments powered by Disqus
Related Articles
Restrict Solr Admin Access
Solr is a search engine built on top of Lucene. It supports REST interface and has lot of built-in capabilities. Solr package has Admin UI interface which has support to perform query and even delete the contents of the index. If you are using Solr in production then you may need to restrict access. I saw couple of questions in the group related to this topic. Thought to write an article explaining few tips to restrict the user access to Solr admin UI.
Why require Searchengine? Why not use database for full text search in Enterprise application.
Most of the database has support of full text search, basically indexing and saarching. MySQL, Oracle and many more databases has in-built full text search. Then what is the need to go for external search engine like Lucene, Sphinx, Solr etc. Check out the advantage of using Searchengine.
An introduction to LucidWorks Enterprise Search
Lucidworks Enterprise search solution is built on top of Apache Solr. It scales seamlessly w/sub-second response times under extreme query loads for multi-billion document collections. It has user friendly UI, which does all the job of configuration and search.
Lucene Vs Solr
Lucene is a search library built in Java. Solr is a web application built on top of Lucene. Certainly Solr = Lucene + Added features. Often there would a question, when to choose Solr and when to choose Lucene.
4 Free Code Snippets Hosting Sites
Most of us would be familar about the project hosting sites like sourceforge, github etc. These sites hosts the complete project, documentation and has a means to track bugs etc. Sometimes we may need to host the simple pieace of code which we may be want to share it with our friends or to post the link in the forum to discuss more about the code.
8 Best Open Source Searchengines built on top of Lucene
Lucene is most powerful and widely used Search engine. Here is the list of 7 search engines which is built on top of Lucene. You could imagine how powerful they are.