Hi all again,
Olay well I am most of the way there now with PHP and mod_rewrite however I
have a problem that is just wreaking my sore hung over head ;-(
Okay well I have never been strong at regex's so here is the problem
Currently on the site on a page in /features/ it will print a list of
sections. Then when the section is clicked on it displays items that belong
to that section.
The below rule changes /features/index.php?section=Music%articleid=11 to
/features/Music/11.html and that is cool.
RewriteCond %{REQUEST_URI} !^/features/index.php$
# The RewriteRule
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?section=$1
RewriteRule ^([a-zA-Z0-9]+)/([0-9]{1,9}).html$
index.php?section=$1&articleid=$2
Now this is where the fun begins.
What if a section has a space or more in its name? So for example "Cooking
Tips". With php I can urlencode this to /features/Cooking+Tips/
But I would like to get mod_rewrite using the above rules to work this out.
Also what happens if I have more that one space in the url eg
/features/Cooking+tips+for+home/
Yeah I know I am really s**** at regex ;-)
Thanks in advance
Aj
PS. Thanks to Adam beacher for helping to get this far ;-)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!