2014-10-07 2 views
1

Так что я использую этот скрипт .htaccess на своем VPS, но он не работает в том месте, где он должен удалить index.php из URL-адреса.Заставить HTTPS и удалить index.php на CodeIgniter

<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 все нормально .. .

+0

У вас есть доступ к файлу ВХост? Если да, убедитесь, что ваш сайт имеет доступ к вашему SLL-порту. –

+0

Имеет доступ к порту. – r3nt3r

+0

Вы получаете какое-либо специальное сообщение об ошибке или код ответа, который может помочь нам выяснить, в чем проблема? –

ответ

0

В application/config/config.php изменения:

$config['index_page'] = 'index.php'; 

к

$config['index_page'] = ''; 
+0

Он изменен с самого начала сайта. – r3nt3r

0

Проверьте VH ОСТ файл, убедитесь, что он выглядит как

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

и не нравится

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

yep это без порта – r3nt3r

Смежные вопросы