Search code examples
apache.htaccessiiswebserverplesk

How to install Apache on plesk17 in server windows


I have Windows server and install plesk17 on that. I have custom CMS and that used .httpaccess .

But my web server is iis and not to run .httpaccess; I can't change server to Linux...

Is Apache Installed On plesk17 Windows?

My main problem is just not running the following code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/index.php?/$1 [L]�

I would appreciate it if I guide you so that I can solve my problem


Solution

  • I can help with converting your .htaccess file to a URLRewrite rule. Please note that URL Rewrite is not part of default IIS install and must be downloaded. Available here: https://www.iis.net/downloads/microsoft/url-rewrite

    Next the commands to create your URL Rewrite rule for Default Website is as follows:

    
    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules" -name "." -value @{name='ConvertedRule';stopProcessing='True'}
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/match" -name "url" -value "^(.*)$"
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/match" -name "ignoreCase" -value "False"
    
    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/conditions" -name "." -value @{input='{REQUEST_FILENAME}';matchType='IsFile';negate='True'}
    
    Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/conditions" -name "." -value @{input='{REQUEST_FILENAME}';matchType='IsDirectory';negate='True'}
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/action" -name "type" -value "Rewrite"
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/action" -name "url" -value "/cms/index.php?/{R:1}"
    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site'  -filter "system.webServer/rewrite/rules/rule[@name='ConvertedRule']/action" -name "appendQueryString" -value "False"
    

    and will produce configuration that looks as follows:

    <rule name="ConvertedRule" stopProcessing="true">
       <match url="^(.*)$" ignoreCase="false" />
       <conditions>
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
       </conditions>
       <action type="Rewrite" url="/cms/index.php?/{R:1}" appendQueryString="false" />
    </rule>