标题含糊不清,因为我不能告诉你出了什么问题。我的应用程序在下面的 .htaccess 文件中运行良好,但是在我强制 ssl 的运动中,有些东西坏了,现在我只得到 500 个内部服务器错误 - 无论是在 wamp 还是在完全独立的生产主机上,所以它不是服务器。这是我的.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
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
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|(.*)\.swf|images|robots\.txt|css|docs|cache)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 /application/errors/404.php
</IfModule>
唯一解决此问题的是删除开头的“IfModule”语句。如果我摆脱那个条件,只留下封闭的代码,并删除整个第二个条件,只留下这个:
RewriteEngine On
RewriteBase /
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
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
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|(.*)\.swf|images|robots\.txt|css|docs|cache)
RewriteRule ^(.*)$ index.php?/$1 [L]
然后应用程序工作,除了整个 .htaccess 文件被完全忽略!Mod_rewrite 也已启用。当我在 git 中切换到我的 master 分支时,我发布的第一个 .htaccess 仍然可以正常工作,但我无法弄清楚是什么对我的生活产生了影响。
任何人?