| Author |
Message |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 387
|
Posted:
Thu Mar 20, 2008 8:01 am |
|
Hardly an original or thought provoking subject line but it's the best I could muster.
I'm tweaking a 'reviews' script at the moment in which the original author has bult in some SEO technique to shorten the url.
I'm not in agreement with his methodolgy and in fact, the url yoursite.com/2/2.php really doesn't float my boat at all!
His methodolgy is merely shortening the uri to the shortest permissible number of characters and that alone has no worth for SEO to my way of thinking.
Luckily I can access a $var which contains the subject 'title' of the reviewed 'item' so it is a simple matter to inject the textual value of the $var into the uri so that links on the page could be indexed with 'subject' lin as part of the link.
However, because the var will either contain whitespace or %20 between words I'm not entirely sure of the best way to convert those instances to hyphens. Should I use a simple str_replace or something else?
I cannot use htaccess directives because that would have no effect on what is actually 'on page' as far as url links are concerned and I do NOT want spiders picking up links with spaces or %20 in them as that would look terrible! |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1360
|
Posted:
Thu Mar 20, 2008 9:23 pm |
|
Yeah, I know what you mean. What you might consider doing is using preg_replace with an array of FROM and array of TO values. preg_replace will walk through the two arrays in sequence doing the search and replace on the entire target string. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1360
|
Posted:
Thu Mar 20, 2008 9:23 pm |
|
Yeah, I know what you mean. What you might consider doing is using preg_replace with an array of FROM and array of TO values. preg_replace will walk through the two arrays in sequence doing the search and replace on the entire target string. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 387
|
Posted:
Fri Mar 21, 2008 2:22 am |
|
Thanks for that I'll look into it.
I need to re-factor the whole link building method he is using as making a url with
2/2/.php
just seems so completely wrong. htaccess should be used to make the link 'better' but not to make the link 'work' because it is formatted incorrectly 'on page'. If you cannot use htaccess then at the moment it means you cannot use the script.
With hindsight, I went public with the site too early so I have had to acquire another license for a seperate intsall in order to make what I think will be improvements.
Thanks again M, I know you are busy  |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 1360
|
Posted:
Sat Mar 22, 2008 12:45 pm |
|
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 387
|
Posted:
Sat Mar 22, 2008 4:03 pm |
|
Agreed
I'll be using the same DB data for my experimental site so when I'm ready, I'll send you a link so you can see the differences.
I wanted to get stuck into this at the weekend but I have been doing a 5 hour drive to Krakow most days (wifes Dad and his g/friend are visiting) and I have decided to develop this gallery module instead as it has been a blast of fun. |
| |
|
|
 |
|
|