biggieuk Posted March 15, 2010 Share Posted March 15, 2010 [search]htaccess dummy re-write help[/search]Hi guys, Im working on tidying up my urls using some htaccess vodoo but need a bit of help with this. Heres my htaccess: RewriteEngine On RewriteRule ^([^/]*)\.html$ /index.php?page=$1 [L] RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?page=$1&id=$2 [L] The dynamic link is: http://www.website.com/index.php?page=news&id=5 which using the above htaccess is now: http://www.website.com/news/5.html Any ideas how I can edit this so that I can have some dummy text at the end, like so: http://www.website.com/news/5/Blah-Blah-Blah.html ? Where 'Blah-Blah-Blah' could be anything. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/ Share on other sites More sharing options...
cags Posted March 15, 2010 Share Posted March 15, 2010 Not tested, but something like this may work if the dummy text will not be required. RewriteRule ^([^/]*)/([^/]*)(/[a-zA-Z0-9-]*)?\.html$ /index.php?page=$1&id=$2 [L] If it is required they just remove the brackets and the question mark, and possibly change the * for a +. Quote Link to comment https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/#findComment-1026340 Share on other sites More sharing options...
biggieuk Posted March 25, 2010 Author Share Posted March 25, 2010 Thanks for this reply, it works a treat. Quote Link to comment https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/#findComment-1031622 Share on other sites More sharing options...
cags Posted March 25, 2010 Share Posted March 25, 2010 Something like this. RewriteRule ^([0-9]+)/[a-zA-Z0-9-]+/?$ /index.php?id=$1[L] Quote Link to comment https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/#findComment-1031623 Share on other sites More sharing options...
biggieuk Posted March 25, 2010 Author Share Posted March 25, 2010 edited the wrong post, but thanks again. ill get the hang of this one day. Quote Link to comment https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/#findComment-1031627 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.