MapFile not working

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 4
Joined: 27 Mar 2012, 10:05

MapFile not working

29 Nov 2012, 12:42

Hi,

We have a new website and we want to 301 redirect the old pages to a new one but the mapfile.txt is not working. Can you please help me with this issue ?

I looked ate the FAQ (Comprehensive map files insight) but nothing is working (or I don't understand it correctly...).

OLD PAGES:
http://www.site.com/page1.cfm
http://www.site.com/page2.cfm
...

Those will ALL point to : index.cfm

Here's the code I use :

.htaccess
RewriteEngine on
RewriteBase /
RewriteMap mymap txt:mapfile.txt
RewriteRule /([^/]+)\.cfm /{mymap:%1} [NC,R=301,L]


mapfile.txt
page1.cfm index.cfm
page2.cfm index.cfm
page3.cfm index.cfm
page4.cfm index.cfm
page5.cfm index.cfm

Thanks for your help!

Gilles

User avatar
Posts: 4
Joined: 27 Mar 2012, 10:05

Re: MapFile not working

29 Nov 2012, 12:57

Just found it !!!!

RewriteEngine on
RewriteBase /
RewriteMap mymap txt:mapfile.txt
RewriteMap mylower int:tolower
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteCond ${mymap:${mylower:%1}|NOT_FOUND} !NOT_FOUND
RewriteRule .? ${mymap:${mylower:%1}} [NC,R=301,L]

User avatar
Posts: 24
Joined: 27 Nov 2012, 21:57

Re: MapFile not working

29 Nov 2012, 23:53

It is great that you have shared it. Cheers!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests