Jump to content

Rewrite URL with dummy text


biggieuk

Recommended Posts

[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!

Link to comment
https://forums.phpfreaks.com/topic/195306-rewrite-url-with-dummy-text/
Share on other sites

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 +.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.