|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Articles
Join Date: Apr 2001
Posts: 0
|
Article Discussion
This is an article discussion thread for discussing the SitePoint article, "Search Engine-Friendly URLs"
|
|
|
|
|
|
#2 |
|
He's No Good To Me Dead
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2003
Location: Slave I
Posts: 24,090
|
This article is old but still very relevant. Implementing what I learned in this article has had a profound impact on my websites. To score it a 10 would be to under-rate its value.
|
|
|
|
|
|
#3 |
|
SitePoint Zealot
![]() ![]() Join Date: Jan 2004
Location: Wisconsin
Posts: 132
|
Yes, I used it when I converted everything from ASP to PHP. VERY useful. 10/10
|
|
|
|
|
|
#4 |
|
Hosting
![]() ![]() Join Date: Feb 2002
Location: Auckland
Posts: 10,687
|
IMHO, Chris Beasley missed the best solution (and gets, at best, a 6/10 for his effort).
Sitepoint's Apache forum has MANY good threads on using Apache's mod_rewrite module in the .htaccess file. With this, I've just completed transitioning from a series of $_GET style URLs to Search Engine Optimized pages (i.e., the http://www.domainname.com/article/## displays the /viewfullarticle?id=## script). There were some knotty things to work out but I believe this is far superior to Chris's path_info, Error Pages and ForceType. Anyone interested in SEO should have a read of Chris's article then have a search through the Apache forum for mod_rewrite (online documentation on mod-rewrite is terrible -- that forum has provided the best information I've found). Regards, DK |
|
|
|
|
|
#5 |
|
SitePoint Enthusiast
![]() Join Date: Nov 2003
Location: earth
Posts: 89
|
Prefer mod_rewrite here as well.
|
|
|
|
|
|
#6 |
|
SitePoint Member
Join Date: Aug 2004
Location: Illinois, USA
Posts: 2
|
forcetype application
Have used this and prefer it, however it appears busted in http 2.0
www.site.com/script involkes the (or even a script with symlinks enabled to script.php but www.site.com/script/parms doesn't even get envolked anymore ? Was using <location which maybe should have/be <file but neither works now. Any suggestions? |
|
|
|
|
|
#7 | |
|
SitePoint Member
Join Date: Aug 2004
Location: Illinois, USA
Posts: 2
|
Quote:
Looks like AcceptPathInfo on is the answer. |
|
|
|
|
|
|
#8 |
|
SitePoint Member
Join Date: Aug 2004
Location: 93402
Posts: 1
|
Fircetype Solution Seems Incompatible with Web Log Tools
I've used the Forcetype solution, and have become aware that Web Log tools (e.g., LiveStats) can not report page activity, because none of my URLs end in file extensions.
Any advice? |
|
|
|
|
|
#9 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2002
Location: Australia
Posts: 2,092
|
Good article, and to confirm it's usefulness doing a search for 'article 485' on google will give this article as the first result :)
|
|
|
|
|
|
#10 |
|
SitePoint Community Guest
Posts: n/a
|
None of these methods work for me, the apache "look back" feature doesnt work on three different servers, what am i doing wrong?
thanks email:webmaster@therandomjoe.com ICQ: 165512867 (prefered) AIM: sryuuza MSN: sryuuza@msn.com |
|
|
|
#11 |
|
SitePoint Evangelist
![]() ![]() ![]() ![]() Join Date: Feb 2005
Location: Preston, Lancs
Posts: 561
|
the only thing missing in this article is what the links should become! as a novice i struggled as the links kept altering. other then that seems to work fine. any one got any tips how to add security to these methods?
|
|
|
|
|
|
#12 |
|
SitePoint Community Guest
Posts: n/a
|
Your forgot a big drawback:
$_GET and $_POST will be ignored with redirections! |
|
|
|
#13 |
|
SitePoint Evangelist
![]() ![]() ![]() ![]() Join Date: Jun 2004
Location: California
Posts: 440
|
Why not explain the method of mod_rewrite with apache?
|
|
|
|
|
|
#14 |
|
SitePoint Community Guest
Posts: n/a
|
Is there a way to use any one of those methods on a IIS server?
|
|
|
|
#15 |
|
SitePoint Enthusiast
![]() Join Date: Oct 2004
Location: Portugal
Posts: 43
|
There is Ivan! Called IISRewrite.
However you can easily make that (php only) methods with ASP... if that's your case. |
|
|
|
|
|
#16 |
|
SitePoint Member
Join Date: May 2005
Posts: 2
|
Is this even nessesary anymore?
Don't most search engines index and follow the whole URL anyway now? I do agree that the url looks cleaner, but to go through the trouble of reqwritting what i have, am i going to get a noticeable impovement in ranking? thanks. |
|
|
|
|
|
#17 |
|
dooby dooby doo
![]() Join Date: Aug 2004
Location: Manchester UK
Posts: 11,067
|
You should notice an improvement in SE rankings but also bear in mind your visitors.
It is far easier to type www.mydomain.com/site than www.mydomain.com/site/id=1&template=id...... etc |
|
|
|
|
|
#18 |
|
SitePoint Community Guest
Posts: n/a
|
If the site is designed with ease of navigation in mind, the user won't need to type the URL anyway. Optimally, visitors should be able to get to an in depth article within three clicks from the home page.
|
|
|
|
#19 |
|
SitePoint Community Guest
Posts: n/a
|
Still, if possible it's probably better to stay on the safe side ;) I think that's the route I'll be taking!
Thanks for this article, I found it really useful. |
|
|
|
#20 |
|
SitePoint Enthusiast
![]() Join Date: Apr 2004
Location: Minnesota, USA
Posts: 62
|
I just wanted to comment on two things:
1.) Seriously, if you are making some sort of dictionary or resource website that is based around searches, allow the user to type in http://example.org/query_here. I must say, that is the most annoying part of Wikipedia for me. Let me type it in myself! I wish dictionary.com would do that also. PHP.net does it wonderfully, just go to php.net/include, and the include() function reference page pops up! 2.) Some people might want to head over to drupal.org and look at their .htaccess file. They used an interesting technique for achieving URLs like this. They basically have everything after the domain name and slash rewritten to ?q=. Therefore, you could type http://example.org/article/215, and explode() the / out of there, call the article function, and then fetch the id 215. Or you could have pages like http://example.org/aboutus and http://example.org/donate without having to create files for all of them (as in the 3rd method mentioned above). |
|
|
|
|
|
#21 |
|
SitePoint Community Guest
Posts: n/a
|
There is a drawback to these types of URL... Yahoo sucks... Yahoo likes to drop the last traing slash and then concatenate directories - using the above examples, a request from Slurp might be
/article/999/12article/999/article12/999 It sounds crazy I know, but I have spent weeks trying to "retrain" Slurp because of this exact problem, only to find it dropping the trailing slash on the retrained URLs A further complication is that Slurp makes up queries for example /article/?id=123, where the id 123 does not exist in any way on your site. So much fun :( |
|
|
|
#22 |
|
SitePoint Addict
![]() ![]() ![]() Join Date: Dec 2005
Posts: 257
|
In my personal experience the mod_rewrite works far better than the other options. I originally used an error page to parse the variables from the names of html files similar to the way you described however occasionally IE had problems and would display its own 404 page. So I settled into using mod_rewrite.
Originally I tried using a directory structure for the rewrites but it was causing trouble with my relative links, so I decided to use the name of a html file to pass the variables the same way as I did in the error method. This way there would be no hanging directories which make it obvious variables are being passed and it left the pages with easy to remember names. If anyone is interested I used the following rewrite rule: RewriteBase / RewriteRule ^([a-zA-Z]+).html$ index.php?mode=$1 This way my entire website appears to be a bunch of static pages while giving me the ease of using a single file. |
|
|
|
|
|
#23 |
|
SitePoint Member
Join Date: Oct 2004
Location: Mumbai
Posts: 13
|
Just wondering why Sitepoint chose PATH_INFO method over mod_rewrite. Is there any specific reason for this decision?
|
|
|
|
|
|
#24 |
|
SitePoint Community Guest
Posts: n/a
|
Thank you for the ideas. The ForceType Directive method works great for my site. I was able to nest the script and now I'll never need to use those silly ?'s in the URL's again.
The only problem I encountered was the first value of the array. In your example, $var_array = explode("/",$PATH_INFO); produces: $var_array[0] = "article.php" $var_array[1] = 999 $var_array[2] = 12 But when I ran the same code on my server, $var_array[0] always returned blank. It's not a problem, just curious as to why this could be happening. Thanks again! |
|
|
|
#25 |
|
SitePoint Community Guest
Posts: n/a
|
maybe your server disable register global
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 10:48.











Linear Mode
