View Single Post
Old 10-10-2007, 11:51 AM   #2 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

Hi Sam,

Try creating a new .htaccess file and adding the following code:

Code:
<IfModule mod_rewrite.c>

	RewriteEngine on

	RewriteRule ^RewriteRule ^news/([0-9]+)-([^\/]+).html$ news.php?id=$1 [L]$

</IfModule>
What this should do is try to catch your news urls and then call news.php passing it the id from the url. As for protection, the in order for the url to be valid it must begin with news/ followed by a numeric value, followed by a hyphen and atleast one single letter, so for instance, this would be valid:

news/1-a.html

but this would not:

news/a-a.html

Hope this helps.
Karl is offline  
Reply With Quote