繁体   English   中英

CodeIgniter .htaccess-500内部服务器错误/ index.php删除

[英]CodeIgniter .htaccess - 500 Internal Server Error/ index.php remove

我有一个像这样的网站(子域)

rabbani.websolocom.xyz

我有这样的.htaccess代码(我使用了Codeigniter):

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

但是,当我尝试访问我的网站时,它会出错(500 Internal Server Error)。 .htaccess文件应该怎么办? 还是我的目录中有其他错误的文件?

用这个

.htaccess (外部应用程序文件夹)

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

这是Codeigniter建议的.htaccess

将.htaccess放在rabbani文件夹中,像这样

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$

试试这两个htaccess

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

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/%1/$1 [L,NC,QSA]

更多htaccess在这里。

这是我的新.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
    #  slashes.
    # If your page resides at
    #  http://www.example.com/mypage/test1
    # then use
    # RewriteBase /mypage/test1/
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

试试这个:如果您在本地系统上使用codeigniter

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

如果要在服务器上使用它,请使用以下命令:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM