Does anyone know How to write htaccess rule for be...
# cfml-general
v
Does anyone know How to write htaccess rule for below? <Files abc.html> order allow,deny allow from all </Files> Rule in web.config file for IIS Server.
a
I googled "online convert iis rule to htaccess rule" and found https://serverfault.com/a/1093655/93620 (first match for me), which linked to https://www.megacolorboy.com/posts/convert-iis-webconfig-to-apache-htaccess-using-javascript/. Does that work for you? It expects the entire file, not just the one rule, but it should point you in the right direction?
v
I need to convert htaccess to IIS rules for the code I mentioned.
a
OK, that sounds like the reverse of what you said, but still... same strategy applies. There are online things that do it. Google is yer friend.
a
I don't quite understand what that rule does as you have "allow from all" which would seem to be the same as having no rule. So what do you want it to do?
a
Might be another rule that blocks access for everything else, so need to open it for that one file?
(difficult to say though)
I'd try to sort it out and then bring back a well-articulated problem, rather than ask other humans to do work that seems to be doable by a computer.
v
I want to know how rules other than url rewrite rules of htaccess can apply on IIS 7 Like <IfModule mime_module> AddHandler application/x-httpd-ea-php74 <IfModule php7_module>
check of mime type
a
So that is a PHP module. Those modules are specific to Apache so you can't just load into IIS.
v
Ok But How can I change apache rule on IIS.
a
This rule does nothing as you are doing an allow all.
Copy code
<Files abc.html>
	order allow,deny
	allow from all
</Files>
If you can explain what you actually want to achieve someone may be able to help.
Or give more context as to what is doing the deny
v
It means No need to add such rules on IIS web.config
What about this rule exist in htaccess
What about this rule? <IfModule mime_module> AddHandler application/x-httpd-ea-php74 .php </IfModule>
a
To deny access to a file in IIS you would do something like:
Copy code
<rule name="myRule" stopProcessing="true">
  <match url="abc.html" />
  <action type="CustomResponse" statusCode="403" />
</rule>
There is a UI in IIS which creates the web.config for you if you are not familiar with the syntax.
v
But that mainly help in url rewrite rule when using import there
is there any thing which can compare code with htaccess and let us know how to write same On IIS
Copy code
<rule name="myRule" stopProcessing="true">
  <match url="abc.html" />
  <action type="CustomResponse" statusCode="403" />
</rule>
I think this code not check the file instead it is checking the url.
I need the code which can check that the if the file exist then no one can access it on IIS
a
That sounds like a permissions question, so on Windows you would set the permissions only on files that you want the IIS User to be able to access. As I say IIS is not a direct match up to how Apache on *nix works.
not sure if it applies to your scenario
j
v
I already try this
It only work for rewrite rules
I want to do gzip compression using Deflate
a
From what I recall (and I seem to remember it being different versions of IIS) you'll need to install the Compression DLL (if not already installed) and then you can enable it via IIS UI.
v
ok