URL Rewriting syntax IIS 8 ISAPI Rewrite 3

870 Views Asked by At

I had a previous post regarding this matter:

ISAPI_Rewrite and Coldfusion Rules

With the help of Helicon Support we were able to create the following rules:

RewriteEngine on

RewriteRule on
RewriteBase /

RewriteCond %{QUERY_STRING} ^filter=brand&brand_id=([^&]+)&brand_name=([^&]+)$ [NC]
RewriteRule ^products-search\.cfm$ /search/%1/%2.cfm? [NC,R=301,L] 

RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^search/([^/]+)/([^._]+)\.cfm$ /products-search.cfm?filter=brand&brand_id=$1&brand_name=$2 [NC,L]

RewriteCond %{QUERY_STRING} ^product_id=([^&]+)&product_title=([^&]+)$
RewriteRule ^product-details\.cfm$ /%1/%2.cfm? [NC,R=301,L]

RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^._]+)\.cfm$ /product-details.cfm?product_id=$1&product_title=$2 [NC,L] 

Their help was much appreciated as i am very new to URL Rewriting. The issue i am having now is that the first rule works, it turns the url from:

www.mysite.com/products-search.cfm?filter=brand&brand_id=98&brand_name=HAMANN

to

www.mysite.com/search/98/HAMANN.cfm

Since i am new to this, i do not understand how to get the css/js/images folders to display on this page, what rule or condition do i use for the RewriteBase / part so that everything on the page loads correctly?

The second part of the .htaccess rules do not actually work which change:

product-details.cfm?product_id=1&product_title=This Is A New Product 

to

products/This_Is_A_New_Product.cfm

Any help would be greatly appreciated

0

There are 0 best solutions below