> >One way to approach this would be to have an ErrorDocument 404 
> >statement in your .htaccess which points to a PHP script.  This 
> >will catch any URLs which don't exist on your system.  The script 
> >can look at the requested URI ($_SERVER['REQUEST_URI']) and see 
> >if it matches (or is similar to) a page you have and want to 
> >display.  If it is, the script can return that content.  If 
> >not, display a helpful error message.
> >
> >James
> 
> Hi, James,
> 
> Good input, as always!
> 
> I had considered this.  I already use these 404 redirects. 
> For example, if you are looking for property number 348 on 
> one of my property websites, the URL 
>
> http://fourwood.com/348
>
> is expanded by the 404 into
>
> http://www.fourwood.com/foursale/showdetail.php?pr=348&S=200
>
> The first is very easy for people to remember and email,
> works fine.
> 
> The problem is, in the case that I am asking about, I don't want 
> the URL changing.  Mod Rewrite seems to be the answer, if I can
> find something that mod rewrite will use to recognise that it is 
> a request for an Article 
> 
> I use this mod rewrite to rewrite 
>
> http://hotcosta.com/Marbella.info
>
> into 
>
> http://www.hotcosta.com/loc.php?T=Marbella
>
> so that the URL remains the same.
> 
> Currently I am thinking of making the URL contain a "SEO useful" folder
> name,> mydomain.com/greencheese/reallytastycheese and get mod rewrite 
> to recognise the URL via the folder name, but I was really looking for 
> a way to get to mydomain.com/reallytastycheese 
> 
> ...but perhaps the SEO useful folder would be better...
> 
> -- 
> Pete Clark


First of all, you can have the 404 script do everything.  If it sees a number, 
look for a valid record number in the DB.  Otherwise see if the keyword exists 
in a title for an article in the database.

If you wanted to, you could have different .htaccess files in directories.  For 
example you could have:

sample.com/art/keyword_from_article

and place a .htaccess file in /art with an ErrorDocument to point to the script 
which handles the article keywords found in the URL.

Lately I've seen an increase in these human-readable URLs getting longer and 
longer to the point where you can't paste a link into an email without it 
getting wrapped and broken.  Further, the server-side systems choke badly with 
the incomplete URL which results.  One could do something like

sample.com/12345/Silly_title_of_article_that_is_way_too_long_for_its_own_good

In your handler script you look for the article number (12345) and ignore the 
rest.  So, if it gets cut off, it won't break things too badly.

Amazon and eBay also have some impossibly long URLs.  I can prune an eBay URL 
because I know which variables are important.  The Amazon ones keep changing 
and are getting harder to work with.

James


Reply via email to