【问题标题】:Error 404 received in Godaddy (.htaccess or web.config)Godaddy 收到错误 404(.htaccess 或 web.config)
【发布时间】:2013-09-26 05:49:32
【问题描述】:

美好的一天。

我建立了一个网站,这是链接:

http://xactosdatosinc.com/ci/codeigniter

在我的本地 PC 中,我设置了一个 .htaccess 文件以拥有一个可以正常工作的干净 URL。当我上传到 Godaddy 时,我可以查看登录页面。但是当我尝试登录时,它显示错误 404。

我搜索了很多 .htaccess 的变体,但都没有成功。实际上,这是我的:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)`
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

有一次,我意识到在我的本地 PC 中,我使用的是 Apache 服务器,这就是 .htaccess 工作的原因。我相信在 Godaddy 中,.htaccess 不被识别。在他们的 ISS 网络服务器中使用的是 web.config

我现在的问题是如何将这个 .htaccess 翻译成 web.config 我希望它在 Godaddy 托管中有效?

提前非常感谢...

【问题讨论】:

  • 您好菲尔,谢谢您的回复。但是乔恩提供了一个我申请的代码。但是只有一个缺少的 XML 标记,下面详细说明...无论如何,谢谢您的帮助...

标签: php apache .htaccess codeigniter mod-rewrite


【解决方案1】:

谷歌上的第一个结果:http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig

<rewrite>
  <rules>
    <rule name="htaccess codeigniter rule" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="^/index.php" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="^/resources" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="^/robots.txt" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php?/{R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

【讨论】:

  • 嗨,Jon Lin,非常感谢...但您提供的代码中肯定只缺少一件事...在之前添加 XML 标记 标签 及其结束标签 ...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-09-18
  • 2014-10-08
  • 1970-01-01
  • 1970-01-01
  • 2014-03-08
  • 2013-05-13
相关资源
最近更新 更多