1

I'm re-writing a Coldfusion site in PHP. I just started learning about IIRF and how it works with IIS 6. For testing purposes, I want a rewrite condition that looks for specific .cfm files and redirects them to corresponding .php files. Then, after the redirect, I want to remove the file extention .php. I'm doing this to try to help with indexing and preserve a high SEO ranking. I'm OK at understanding regex, but no expert, so how would I write this in my .ini file?

post.72
  • 333
  • 4
  • 14

1 Answers1

1

Perhaps you're just being casual in your terminology, but it sounds like you may be confusing URL rewriting with redirecting.

It sounds like you want a user who is requesting path/page.cfm to be redirected to path/page, which will be your new canonical URL. To accomplish this, you'll want a rule like:

RewriteRule (*).cfm $1 [R=301,L]

In addition, you would like the new request for path/page to be processed by the file at path/page.php. To accomplish this, you'll want a rule like:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (*) $1.php [L]
Jeremy Stein
  • 19,171
  • 16
  • 68
  • 83