Hi,

I'm going to show you a simple way how to pretend your IIS web-server as Apache. The way based on Helicon Ape tool. I will remind you Helicon Ape is Apache emulator under IIS execution environment. It emulates some Apache modules and HeliconTech is going to extend Ape functionality in the future.

Now we need only one Helicon Ape module - mod_headers. It helps you to manage request and response HTTP headers. But you have to know, there are a few technical differences between mod_headers for Apache and for Helicon Ape. Apache doesn't allow to modify some basic headers and the way described here isn't appropriate for.

Ok. Let's do it.

I told supra I'm going to modify HTTP headers. If we want pretend a server we have to modify response headers. I've requested http://localhost:80/index.html under IIS7 and I've got these response headers:

The same request under Apache gives me these headers:

You can see Server and X-Powered-By headers are giving my IIS server away. What can we do for that? I think we have to remove X-Powered-By header and set for Server header a new value.

Here is the rule for .htaccess file which sets Server header

Header set Server "Apache/2.2.9 (Win32) PHP/5.2.6"

To remove X-Powered-By we could use this rule:

Header unset X-Powered-By

But unfortunately it's not possible for X-Powered-By because the thing which sets it operates after Helicon Ape. You can remove the header manually in IIS Manager:



Finally the response should looks like:

and this is what I wanted.

P.S.: This notice hasn't security context, because there are a lot of smart hacker tools, e.g. nmap, is able to tell much more about your web-server. I just wanted to show how it possible to use Helicon Ape.


Screen shot from my CS battle ;)  You can see me on the left.

Hi,
These simple rules seek for FileName.aspx if you request FileName.shtml and if .aspx file will be found - you get it, otherwise you get .shtml file :

RewriteCond %{REQUEST_FILENAME} ^(.*)\.shtml$ [NC]
RewriteCond %1\.aspx -f [NC]
RewriteRule ^(.*)\.shtml$ $1.aspx [NC,L]

As far as some ISAPI_Rewrite users don't understand the basic conception they occasionally ask strange questions on support.
I've decided to write a simple notice which should make an explanation for ISAPI_Rewrite users.

Rules allow to link a real request with request which will be seen by user.
You can use regular expressions and some conditions to get more flexibility.
If you want to use the request like /destination-url.html, 
ISAPI_Rewrite should know what real URL corresponds to it. And it should be 
pointed in the rules.

There are many ways to write rules and each of them depends on specific situation.
For example if you have these pages:


/index.php?q=444 => /page.html
/index.php?q=345 => /another-page.html
/index.php?q=999 => /about.html


You would write these rules:

RewriteRule ^/page\.html$ /index.php?q=444 [NC,L]
RewriteRule ^/another-page\.html$ /index.php?q=345 [NC,L]
RewriteRule ^/about\.html$ /index.php?q=999 [NC,L]


In addition it is advisable to use map-files feature there.
In this case you are creating the text document (e.g. map.txt) with the content:

page 444
another-page 345
about 999


And you are writing the following rules in .htaccess:


# Get access to map-file using map variable
RewriteMap map txt:map.txt

# Use internal function tolower for getting string
# in lower case
RewriteMap lower int:tolower

# Get requested file
RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]

# Seek in map-file
RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND

# Make rewriting if the record was found
RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]


To write the rules I have to know what SE-friendly URLs
you want to use and what real URLs should correspond to them.

Hi,
I just found a couple of funny articles about programming languages.
Please find them here:
If programming languages were cars...
If programming languages were religions...