Msg#: 4414013 posted 9:11 am on Feb 4, 2012 (gmt 0)
It isn't actually a forum I'm running, it's something I've started from scratch (I realise now that mentioning phpBB was misleading!). So to answer your question, no there are no URL rewriting packages.
Can you post or point me to an example of how to do the 43-what-is-the-capital kind of thing? Although I'm quite new to PHP I am getting the gist of it so I could probably implement it.
Msg#: 4414013 posted 7:18 pm on Feb 4, 2012 (gmt 0)
When you want to link to the URL that will show page "43" of your site, look in the title table of your database for the page title of page 43 and then construct the href for the URL by using the page number and that page title (normalised to lower case, with spaces and other punctuation replaced with hyphens).
When the user clicks on href="/43-what-is-the-capital-of-Peru" the browser sends a request to the server. This RewriteRule will call your script...
Your script first needs to check (by looking in the database table) that the ID is valid. If not, send a 404 HEADER and a human readable page of html and text with an error message. Next, check that the requested page title is correct for this page ID. If the title is not valid for this ID, send a 301 redirect to the correct URL. If the ID and title are both valid, pull the page content from the content table of the database, then build the HTML page and send it to the browser.
At no point do you "redirect" to a parameter-based URL. Instead you should internally "rewrite" requests to be internally served by a parameter based internal filepath.
If someone does request www.example.com/?id=43&text=what-is-the-capital-of-Peru or www.example.com/index.php?id=43&text=what-is-the-capital-of-Peru or for that matter www.example.com/?text=what-is-the-capital-of-Peru&id=43 or www.example.com/index.php?text=what-is-the-capital-of-Peru&id=43 then you should redirect the user to www.example.com/43-what-is-the-capital-of-Peru to prevent duplicate content issues.
This RewriteRule is the reverse of the first example, but needs an additional bit of code to prevent an infinite redirect-rewrite loop. This extra line of code is a RewriteCond that checks THE_REQUEST to ensure that only parameters in an external request are redirected, not those from a previous internal rewrite.