Forum Moderators: phranque
## URL that I am trying to Rewrite
## NewsItem.php?id=1&c=C-P&iss=news_vol1issue2
## rewrite would look like this
## id1cC-Pissnews_vol1issue2.htm
RewriteEngine on
RewriteBase /
RewriteRule ^id([^.]+)c([^.]+)iss([^.]+).*$ NewsItem.php?id=$1&c=$2&iss=$3 [T=application/x-httpd-php]
Welcome to WebmasterWorld!
The pattern
^id([^.]+)c([^.]+)iss([^.]+).*$
will not match your friendly URL as intended. I'd suggest a review of the regular-expressions tutorial cited in our forum charter [webmasterworld.com].
A better rule might be:
RewriteRule ^idc(.+)iss([^.]+)\.htm$ /NewsItem.php?id=1&c=$1&iss=$2 [[T=application/x-httpd-php],L]
The Regular Expressions Tutorial at the bottom of the Forum Charter you provided was what I needed. It made me take a different approach. Here is the working file for reference. I had a hyphen in the "c" variable in the original post. ie. c=C-P. By changing the variable to "CP" instead of C-P, and finessing the regular expression I was able to get it to work. Thanks for the direction.
RewriteEngine on
RewriteBase /
RewriteRule ^id([0-9]+)c([A-Za-z]+)iss([^.]+)\.htm$ /NewsItem.php?id=$1&c=$2&iss=$3 [T=application/x-httpd-php]