如何在服务器Windows中的plesk17上安装Apache

时间:2019-04-04 12:29:46

标签: apache .htaccess iis webserver plesk

我有Windows服务器,并在上安装plesk17。 我有coustom CMS,并且使用了.httpaccess 但是我的Web服务器是iis,不能运行.httpaccess 我无法将服务器更改为Linux ... Apache是​​否安装在plesk17 Windows上? 我的主要问题是不运行以下代码:

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

如果能为您提供指导,以便解决问题,我将不胜感激

1 个答案:

答案 0 :(得分:1)

我可以帮助您将.htaccess文件转换为URLRewrite规则。请注意,URL重写不是默认IIS安装的一部分,必须下载。在此处可用:https://developers.google.com/maps/documentation/urls/url-encoding

接下来,用于为默认网站创建URL重写规则的命令如下:


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"

并生成如下所示的配置:

<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>