Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-16-2010, 03:08 AM   PM User | #1
amskape
New Coder

 
Join Date: Jan 2010
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
amskape is an unknown quantity at this point
Thumbs down How To make SEO Friendly URL

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

possible.


Explanation by Example :

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

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

But what I want is, The name of the Article in the URL like :
http://www.sitename.com/article/the_...e_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.

I am waiting for your Good help

Regards
Anes

Last edited by oracleguy; 05-16-2010 at 06:59 AM.. Reason: remove email address and removed bold typeface
amskape is offline   Reply With Quote
Old 05-16-2010, 05:28 AM   PM User | #2
Len Whistler
Senior Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Len Whistler is on a distinguished road
article.php?id=5 is a SEO friendly URL just like showthread.php?t=196155, which is the URL of this thread. When you Google coding problems you will find that the threads on CodingForums come up regularly on the 1st page of the results, sometimes within hours - now that's SEO friendly as you can get.



--------------
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 05-16-2010, 05:31 AM   PM User | #3
dEcade
New to the CF scene

 
Join Date: Dec 2009
Location: Saskatchewan, Canada
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dEcade is an unknown quantity at this point
The only problem with doing it that way would be if one article has the same name as another.

You could have it so that you use

http://www.sitename.com/article.php?...icle_name_here

and it looks for the name in the database rather than the id number.

I would include the id number in the url so that there isn't any confusion and just have the article name tag along.

www.sitename.com/article/5/name_of_article/
dEcade is offline   Reply With Quote
Old 05-16-2010, 05:32 AM   PM User | #4
Len Whistler
Senior Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Len Whistler is on a distinguished road
This thread is number 8 first page by searching thread title: How To make SEO Friendly URL And only 2 1/2 hours after original post.


http://www.google.com/#hl=en&source=...59ab474882bfe2



--------------
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 05-16-2010, 07:04 AM   PM User | #5
is_set
New to the CF scene

 
Join Date: May 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
is_set is an unknown quantity at this point
its very easy use any fuction depend on replace ' ' to '_' and add it in the title of the page for the url
is_set is offline   Reply With Quote
Old 05-16-2010, 03:59 PM   PM User | #6
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
As Len mentioned, all valid URI's are search engine 'friendly'. The whole S.E.O thing is a term thrown around and used so that the people spouting it can sell their software and/or services. Crap or nonexistent content will lead to crap ranking no matter what your URI format, and the converse also applies. Good content, well indexed and ranked.

I've yet to see one S.E.O "expert" prove otherwise, or even have a believable argument to the contrary.
MattF is offline   Reply With Quote
Old 05-16-2010, 08:25 PM   PM User | #7
kbluhm
Senior Coder

 
kbluhm's Avatar
 
Join Date: Apr 2007
Location: Philadelphia, PA, USA
Posts: 1,502
Thanks: 2
Thanked 258 Times in 254 Posts
kbluhm will become famous soon enough
These types of URLs are probably better explained and sold as USER friendly rather than SEO friendly. I agree with Len, search engines these days are smart. The URLs are easier to understand semantically from a user point of view, which is why -- and only why -- I find them useful. But they don't really help SEO a huge amount.
__________________
ZCE
kbluhm is offline   Reply With Quote
Old 05-16-2010, 08:39 PM   PM User | #8
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Quote:
Originally Posted by kbluhm View Post
The URLs are easier to understand semantically from a user point of view, which is why -- and only why -- I find them useful.
Aye, they can be handy in that regard. If someone just drops a link on a page, the title inclusion in the link can give one a passable idea of what it's about.
MattF is offline   Reply With Quote
Old 05-24-2010, 03:36 PM   PM User | #9
seouk512
New to the CF scene

 
Join Date: May 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
seouk512 is an unknown quantity at this point
SEO Friendly URL

As it is admitted fact that google dont give more attention to seo friendly URL but it will increase the points. Google mostly gives importance to Meta Values + Contents in the body.

There are various ways to make search engine friendly URL but remember two points.

1. only use alpha numeric and - sign in the place of space character.
2. dont make it lengthy, it should be 100% relevant to topic


Thanks & Regards
seouk512 is offline   Reply With Quote
Old 07-29-2010, 11:48 PM   PM User | #10
disastro
Regular Coder

 
Join Date: Jul 2010
Posts: 185
Thanks: 3
Thanked 42 Times in 42 Posts
disastro is on a distinguished road
I agree with most of what the other posters are saying. These 'pretty' URLs won't do much for SEO but can be easier for users.

To answer your question. Assuming your .htaccess file looks something like this:
Code:
Options +FollowSymLinks
RewriteEngine On

RewriteRule ([^/]*)/([^/]*) index.php?type=$1&id=$2 [L]
Where your index.php will take the "type" parameter as "article", "examples", "something else" etc. And "id" is the article id, then once the first two parameters are given, the rest make no difference.

For example:
Code:
http://www.mysite.com/article/5
http://www.mysite.com/article/5/The-Article-Title
http://www.mysite.com/article/5/Some-Random-Text
All these links will resolve to the same article (index.php?type=article&id=5)
You can give it whatever title (in the link href) you wish.

Of course, the .htaccess above is not what you would actually use (you will need to make sure requests for CSS, javascript and images all get through).
disastro is offline   Reply With Quote
Old 07-29-2010, 11:54 PM   PM User | #11
disastro
Regular Coder

 
Join Date: Jul 2010
Posts: 185
Thanks: 3
Thanked 42 Times in 42 Posts
disastro is on a distinguished road
Man, I really should have checked the date on this thread.
Don't know why it popped up to the first page.
(Also, not relevent to PHP).

Here's hoping it sinks back down to wherever it came from.

Sorry folks. Nothing to see here.
disastro is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, php, seo friendly url

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:31 AM.


Advertisement
Log in to turn off these ads.