Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 强制HTTPS并删除CodeIgniter上的index.php_.htaccess_Codeigniter - Fatal编程技术网

.htaccess 强制HTTPS并删除CodeIgniter上的index.php

.htaccess 强制HTTPS并删除CodeIgniter上的index.php,.htaccess,codeigniter,.htaccess,Codeigniter,所以我在我的VPS上使用了这个.htaccess脚本,但是它在应该从url中删除index.php的地方不起作用 <IfModule mod_rewrite.c> RewriteEngine On #Force SSL RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://domain.com/$1 [R,L] #Removes access to the system folder by users. #Additi

所以我在我的VPS上使用了这个.htaccess脚本,但是它在应该从url中删除index.php的地方不起作用

<IfModule mod_rewrite.c>
RewriteEngine On

#Force SSL
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
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>

<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.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule> 
Options -Indexes
正如我所说的,重定向一切正常,但是当我想打开domain.com/projects时,没有发现错误,但是如果我添加domain.com/index.php/projects,一切正常…

在application/config/config.php中更改:


检查VHost文件,确保它看起来像

<VirtualHost *>
    DocumentRoot "C:\xampp\htdocs\http"
    ServerName localhost
</VirtualHost>
而且不像

 <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\http"
    ServerName localhost
 </VirtualHost>

自网站启动以来已更改。您有权访问VHost文件吗?如果是,请检查您的网站是否有权访问您的SLL端口。它有权访问该端口。您是否收到任何特定的错误消息或响应代码,以帮助我们找出问题所在?未找到此服务器上未找到请求的URL/dev。只是这样:/没有https重定向,一切都很好,但当我添加它时,它就是不工作。。。我也尝试了其他代码,但没有任何变化……这个怎么样?是的,它没有端口
<VirtualHost *>
    DocumentRoot "C:\xampp\htdocs\http"
    ServerName localhost
</VirtualHost>
 <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\http"
    ServerName localhost
 </VirtualHost>