我有一个这样的网站(子域)
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。
这是我的新.htaccess
<Ifmodulee 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] </Ifmodulee>
试试这个:如果你在本地系统上使用codeigniter
<Ifmodulee mod_rewrite.c> RewriteEngine On RewriteBase /projectfolder/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /projectfolder/index.php/$1 [L] </Ifmodulee>
如果你在服务器上使用它,那么使用这个:
<Ifmodulee 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] </Ifmodulee>