SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
Thread: search engine friendly URLs?
-
Mar 5, 2001, 17:19 #1
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
I want to produce search engine friendly URLs however I don't know how. I looked at all the other threads about this and really cannot firgure out what to do.
Can someone please gives me step by step directions.
Thanx so much.
-Peter
EDIT: When I do this, will stuff still work like: select # from article where ID=$id - Here $id would come from the title.???Last edited by petesmc; Mar 5, 2001 at 17:35.
-
Mar 5, 2001, 17:36 #2
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
Try the article at geekarea.org.... It is down at the bottom, http://www.geekarea.org
ssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
-
Mar 5, 2001, 17:39 #3
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That is the one i tried to use but failed.
Please can anyone give me instructions on what code, and where to put it?
Thanks
-
Mar 5, 2001, 19:33 #4
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ok...I've semi worked it out:
Code:$url_array = explode("/",$PATH_INFO); for($i=1;$i<count($url_array);$i++) { $data[$url_array[$i]] = $url_array[++$i]; } $extract = @extract($data);
Code:<? if (count($textarray) > 1) { // SELECT BOX reset($textarray); printf('<form action="%s" method="GET" name="theform">', $PHP_SELF); print "\n"; print "<select name=\"page\" onChange=\"document.theform.submit(); \">"; print "\n"; foreach($textarray as $key => $value) { if ($page == $key) { printf('<option value="%s" selected>%s', $key, $textarray[$key]["title"]); print "\n"; } else { printf('<option value="%s">%s', $key, $textarray[$key]["title"]); print "\n"; } } print "</select>"; print "\n"; printf('<input type="hidden" name="aid" value="%s">', $aid); print "\n"; print '</form>'; print "\n"; //END SELECT BOX } ?>
http://www.codingclick.com/article.p...?page=0&aid=15
Even though that URL exists, that is really tacky. I also noticed that SP.com doesn't use the search engine friendly URLs in a text box. Is this because it isn't possible?
Please help...I think I'll do it the old way for select boxes...
Peter
-
Mar 20, 2001, 07:02 #5
- Join Date
- Feb 2001
- Location
- Melbourne Australia
- Posts
- 6,282
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
ok here's what I have found.
I've put a file called articles.php into the root web directory (at mostlyamphigory.com).
If you type
http://www.mostlyamphigory.com/articles.php/33
it works,
but if you type
http://www.mostlyamphigory.com/articles/33
It also works! For some reason it realises that "articles" is a php file, and parses it right there and then. Is this normal? I think it is fantastic! I can get articles.php to parse the URI and nobody (not search engines-not nobody) even knows it is php...
Is this normal, and will it work with everyone? You can try it now at the above addresses. Type ANYTHING YOU WANT after the articles/ - no I haven't set it up to load as an errordocument in an .htaccess or anything...
-
Mar 20, 2001, 07:32 #6
- Join Date
- Feb 2001
- Location
- Melbourne Australia
- Posts
- 6,282
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
petesmc - could you use method=POST instead? That way the extra info is still passed on but not on a query.
The url could be
http://www.codingclick.com/article.php/aid/15/page/1
And the variables $page and $aid would be available in the resulting page, although you don't need them, and you can use the uri.
Is there a reason I cannot see why this method=post wouldn't work? I'm a beginner, so forgive me if I am totally wrong...
-
Mar 20, 2001, 11:42 #7
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
It does work now and I'm using it.
Thanks for all you help
Peter
-
Mar 21, 2001, 13:08 #8
- Join Date
- Mar 2001
- Location
- Washington State
- Posts
- 70
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Check out :
http://phpbuilder.com/columns/tim19990117.php3
http://phpbuilder.com/columns/tim20000526.php3
See user comments too.
Bookmarks