By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

How To make SEO Friendly URL

P: 55
Hi Friends , My need I depicted Below.... Please Help me how it can

possible.


Explanation by Example :

Suppose, there is one website url :
www.example.com/article.php?id=5

I can convert the URL in SEO friendly manner with rewrite rule in
.htaccess file as below :
www.example.com/article/5 [I CAN DO THIS]

But what I want is, The name of the Article in the URL like :
www.example.com/article/the_name_of_the_article_here [I WANT THIS]

I tried lot for the solution of this problem but didn't got any.
Please tell me if you can suggest any tip.

You can contact me : <email removed>

I am waiting for your Good help

Regards
Anes
May 16 '10 #1
Share this Question
Share on Google+
2 Replies


P: 5
You need to create a column e.g. your article table (given that the articles are in a database) that holds that value, so that you can look it up that way.

You could e.g. set the value automatically from the title on save just by making it lowercase, restricting it to be alfanumeric, and replace spaces with underscores.

Example table:
Expand|Select|Wrap|Line Numbers
  1. ID     TITLE          URL_SLUG     CONTENT
  2. 5      The Name    the_name       .....
  3.  
Then the SQL needs to be something like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT title, content FROM articles WHERE url_slug = '$slug'
  2.  
Just make sure to clean the contents of $slug before running it into the query, to avoid sql injection etc.

Does it make sense?
May 16 '10 #2

Atli
Expert 5K+
P: 5,058
I can convert the URL in SEO friendly manner with rewrite rule in
.htaccess file as below :
www.example.com/article/5
Note that changing an URL from example.com?article.php?id=5 to example.com/article/5 doesn't make the slightest difference to a search engine. As far as SEO goes, the difference this makes is negligible. Neither does putting the title in the URL. -- This may have had an effect in the past but search engines have gotten smarter and the effect it had back then has long since been eliminated.

These sort of changes are purely cosmetic, intended for the users of the site; so they can more easily remember and/or use the URL. Usually the effort of designing a proper rewrite rule is wasted, and you always run the risk of accidentally messing up the URL, which may even hurt your SEO.

See Dynamic URLs vs. static URLs in the Goolge Webmaster Central Blog, for example.
If you have a dynamic URL which is in the standard format like foo?key1=value&key2=value2 we recommend that you leave the url unchanged, and Google will determine which parameters can be removed; or you could remove uncessary parameters for your users. Be careful that you only remove parameters which do not matter. Here's an example of a URL with a couple of parameters:
May 16 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.