Reputation: 1663
Morning All,
I have classified ads with various categories and sub categories and I want to do a url rewrite using IIS7. I need to make up a regular expression that could possibly have up to 5 categories and sub categories for example:
or
http://tampa.storeboard.com/classifieds/jobs/work-from-home/social-media-networker/380
notice the numerical value at the end of each url, this is the part I am interested in retrieving as it is the ID for the eventual URL which would be:
http://tampa.storeboard.com/classifieds/viewad.asp?RegionID=23&ClassAdID=390
How can I create a regular expression that can hunt out the integer on the end and also extract the domain name e.g. tampa.storeboard.com
Many thanks for your help.
Best Regards, Paul
Upvotes: 0
Views: 894
Reputation: 3114
RewriteCond REQUEST_URI !/classifieds/viewad.asp
RewriteRule /classifieds/.*/(\d*)$ /classifieds/viewad.asp?Region=%{HTTP_HOST}&ClassAdID=$1
Upvotes: 0
Reputation: 21300
^http://([^/]+).*?(\d+)$
group 1 for domain name , and group 2 is for ID. It has been tested with RAD regular expression designer.
Upvotes: 2