Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

Url rewriting rule

$
0
0
Hello there,
 
I need some clever regular expression writing in IIS7 to redirect traffic from one site to another, the pages are similar in structure but information needs re-writing.

Here's an example:

http://www.mysite.com/manufacturers/Name_of_Manufacturer_6828/Name_OF_Product_43146.htm

needs to be structured as the following

http://www.newsite.co.in/free-msds-download/name-of-manufacturer/name-of-product/

Here's what needs changing:

1). Only Alpha, Numeric and hyphen's allowed.
2). Change '_' to '-'.
3). Remove the '_NUMBER' directly after the manufacturer name and before the '/'.
4). Remove the '_NUMBER' directly after the product name and before the '.htm'.
5). Remove the '.htm' and replace with a '/'.

It needs writing into the code below please as a permanent 301 redirect:

Viewing all articles
Browse latest Browse all 224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>