![]() |
mod_rewrite for page title
Hello,
Maybe not beginner in PHP but totally novice when it comes to Apache files. So, I'll appreciate your patience. The problem that I want to resolve is: With PHP functions and parametters, I'm able to pass to the page as title eg a Classified's title. The problem comes when I want to make the url: Code:
classifieds.php?do=viewitem&itemid=xxx&title=xxxCode:
classifieds/title_here.htmlCode:
<IfModule mod_rewrite.c>http://www.microdemosite.com/dev4/cl...item&itemid=53 (even if I need to change a bit the code to replace spaces with underscores). Thank you in advance Maria |
It looks like you're attempting to create the following structure, correct me if I'm wrong;
/classifieds/{$itemid}_{$title}.htmlThe following should do the trick: Code:
RewriteEngine OnHth Edit: This allows a lot of freedom in how the title is presented. If you want to ensure that it's only alphabetical, or alphanumerical, replace [^.] with [A-Za-z] or [A-Za-z0-9] or finally [a-z] with NC added at the end [NC,L] |
Thank you for your help, but unfortunatelly it dosen't works.
http://www.microdemosite.com/dev4/cl...item&itemid=15 If you visit the page you'll see the title to be as I want to be in the URL. Maria |
Works fine for me, I tested it locally. If you just need itemid and not title like the url you posted suggests, then you might try this:
Code:
RewriteRule ^classifieds/([0-9]+)_[^.]+\.html$ classifieds.php?do=viewitem&itemid=$1 [L] |
| All times are GMT. The time now is 09:28 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0