Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess and Windows Hosting
#1
Currently using GetSimple on a Windows host. However, the generation of .htaccess files can cause a problem (every time I go on the health check page for example). This is because some IIS extensions recognise these files, for the purpose of password protecting folders.

To work round this, I have had to do a check every time a .htaccess file may be generated.
Code:
if(PHP_OS != 'WINNT') { ... htaccess creation ... }

Due to the fact that not having .htaccess files prevents "pretty url's", I have worked around this through the use of a web.config file. Protecting folders should work in IIS 6 (Windows 2003), however the url rewriting requires IIS 7 (Windows 2008) and the URL Rewrite add-on.
Code:
<?xml version="1.0"?>
<configuration>
    <location path="data">
        <system.web>
            <authorization>
                <deny users="*" />
            </authorization>
        </system.web>
    </location>
    <location path="data/uploads">
        <system.web>
            <authorization>
                <allow users="*" />
            </authorization>
        </system.web>
    </location>
    <system.webServer>
        <rewrite>
          <rules>
            <rule name="getsimple">
                <match url="/?([A-Za-z0-9-]+)/?$"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="index.php?id={R:1}"/>
            </rule>
          </rules>
        </rewrite>
    </system.webServer>
</configuration>

Would it be possible for GetSimple to be changed to prevent the creation of .htaccess files on a Windows host (the side effect of this will be no folder protecting or url rewriting on Apache Windows, but I've not seen a Web Host offer this and it make no real sense to do so). Without this check, I have to trawl through the source to make sure these files aren't created.
-- Sam
Reply


Messages In This Thread
.htaccess and Windows Hosting - by SamWM - 2010-11-20, 01:58:01
.htaccess and Windows Hosting - by Zegnåt - 2010-11-20, 02:20:39
.htaccess and Windows Hosting - by yojoe - 2010-11-20, 07:06:47
.htaccess and Windows Hosting - by SamWM - 2010-11-27, 02:13:13
.htaccess and Windows Hosting - by Zegnåt - 2010-11-27, 02:59:04
.htaccess and Windows Hosting - by novagiant - 2011-04-15, 11:58:03



Users browsing this thread: 1 Guest(s)