我有一个这样的网站(子域)
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内部服务器错误)。我应该如何处理我的.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
<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>
试试这个:如果您在本地系统上使用代码点火器
<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>