【问题标题】:Configuring a htaccess配置 htaccess
【发布时间】:2016-03-15 01:05:38
【问题描述】:

我正在尝试开发一个 codeigniter 应用程序,当我在我的 xampp 上运行它时,一切正常,但是当我在 1and1 的服务器上运行它时,我收到错误 500。

我和 1and1 谈过,他们说,问题出在这个 htaccess 上,我不明白为什么?

这是文件:

 <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]  
 </IfModule>
<Files "index.php">
   AcceptPathInfo On
</Files>  

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 30
php_value max_input_time 30

问题出在哪里?非常感谢

【问题讨论】:

  • 检查您的错误日志。
  • 我看不到它们,因为它是共享服务器,所以 1and1 不允许看到 apache 日志。
  • 尝试删除 php_values ,您的主机可能已禁用它们。看看它是否在没有它们的情况下工作。
  • @Charly66 - 那么他们应该能够准确地告诉你问题的原因是什么,因为他们自己可以访问日志......

标签: php .htaccess codeigniter


【解决方案1】:

在 1and1 中,您无法更改服务器 php 规范,例如:

php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 30
php_value max_input_time 30

尝试删除这些行。

另外,这是我在 1and1 服务器上工作的 .htaccess 文件:

#Deny from all
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^core.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

如果 CI 安装在相对于 .htaccess 的另一个文件夹中,则应将 RewriteBase / 更改为 /CI 文件夹

【讨论】:

    猜你喜欢
    • 2016-01-05
    • 1970-01-01
    • 2013-10-18
    • 2019-04-01
    • 2021-02-16
    • 2017-02-11
    • 1970-01-01
    • 1970-01-01
    • 2018-06-05
    相关资源
    最近更新 更多