real_illusions Posted October 22, 2011 Share Posted October 22, 2011 Hi all, I have a rule setup thats similiar to another that works, but this one doesn't, and I cant work out why. Rule is as follows: RewriteRule ^latestnews-([a-zA-Z]+)/?$ newsitem.php?item=$1 [NC,L] Where the ending variable is used to get a database item, and thus displays the right content on the page, and is also displayed in the friendly URL. For example: /newsitem.php?item=newsitem-goes-here would appear as: /latestnews-newsitem-goes-here But instead, I get a 404 error. Now, I have a similiar setup on another page but that uses PHP switch statements to determine the content as the amount of content is quite small compared to this one that uses a database. The un-friendly URL with the variable in works fine, displays the content all ok, its just when accessing the friendly URL that it all goes a bit wonky and spits out a 404. Any ideas? Link to comment Share on other sites More sharing options...
Don E Posted October 22, 2011 Share Posted October 22, 2011 On your webpage with the friendly URL, what does it exactly look like? is it actually: /latestnews-newsitem-goes-here ? Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2011 Share Posted October 23, 2011 I think you're missing a hyphen in part of your expression:([a-zA-Z-]+)You might also want to include numbers there too. Link to comment Share on other sites More sharing options...
real_illusions Posted October 23, 2011 Author Share Posted October 23, 2011 Ah, that was it, the - missing in the expression. Always something so simple you overlook and then someone else points it out and you feel like an idiot. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.