All request now going through single file

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 1
Joined: 01 Oct 2013, 16:21

All request now going through single file

01 Oct 2013, 16:31

We have moved a web site into a framework that requires all pages to be requested through a single file, 'index.cfm'. I'd like to do two things:
  1. All requests for anything other than '/index.cfm' should be redirected to http://www.host.com/index.cfm
  2. Eventually, specific subfolders will be redirected to specific parameters: http://www.host.com/foo/index.cfm to http://www.host.com/index.cfm?FA=bar.home
    If a request doesn't match, then the first condition should be followed.

Can I do these two things at the same time? There will be requests with subfolders that end in 'index.cfm', but these are still illegal now.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: All request now going through single file

02 Oct 2013, 09:54

Hello,

We can easily make this work for you:

1) To redirect everything (except index.cfm) to index.cfm
Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/index\.cfm$ [NC]
RewriteRule .* /index.cfm [NC,R=301,L]


2) You would want to put these rules BEFORE index.cfm redirect:

Code: Select all
RewriteRule ^foo/index\.cfm$ /index.cfm?FA=bar.home [NC,L]


I assume these won't be redirects per se, rather rewrites.

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 12 guests