代码点火器 3 Mod_rewrite Plesk
Codeigniter 3 Mod_rewrite Plesk
所以我在 GoDaddy 上传了我的网站,我使用了 Windows 主机 (Plesk)。我唯一的问题是,据我所知,由于它不是 运行 Apache,它不会读取我的 .htaccess 文件,该文件包含我所有的 mod_rewrite 代码来删除 index.php 在 URL 中。所以我的问题是如何在 Plesk 中实施 mod_rewrite?
您可以将 .htaccess 文件重写到 IIS 的 web.config 并将其放在 /httpdocs 文件夹中。
您可以通过 this or this online converter or if you have Windows Server you can convert .htaccess by this guide 等指南完成(或者您可以分享您的 .htaccess,我会尝试为您转换)
我找到了这个snippet也许它可以帮助你:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
所以我在 GoDaddy 上传了我的网站,我使用了 Windows 主机 (Plesk)。我唯一的问题是,据我所知,由于它不是 运行 Apache,它不会读取我的 .htaccess 文件,该文件包含我所有的 mod_rewrite 代码来删除 index.php 在 URL 中。所以我的问题是如何在 Plesk 中实施 mod_rewrite?
您可以将 .htaccess 文件重写到 IIS 的 web.config 并将其放在 /httpdocs 文件夹中。
您可以通过 this or this online converter or if you have Windows Server you can convert .htaccess by this guide 等指南完成(或者您可以分享您的 .htaccess,我会尝试为您转换)
我找到了这个snippet也许它可以帮助你:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>