удалить index.php из url в codeigniter в cpanel

0

Я не использую локальный хост. На cpanel установлен код. следующие изменения, которые я сделал в config.php до

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

после

$config['index_page'] = '';

также изменил протокол uri

$config['uri_protocol'] =  'REQUEST_URI';

→ Файл htaccess

Deny from allDirectoryIndex index.php
RewriteEngine on

####################
# Forcing HTTPS #
####################
RewriteCond %{HTTP_HOST} ^brittvendors.com [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.brittvendors.com/stitch/$1 [L,R=301]

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./$1 [L,QSA]

####################
# GZIP COMPRESSION #
####################
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

##########################
#  expire dates for cache #
##########################
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"

Что изменилось, мне нужно сделать, чтобы получить результат на http://brittvendors.com/stitch/home/index, а не на http://brittvendors.com/stitch/index.php/home/index

Теги:
codeigniter
.htaccess
url
cpanel

1 ответ

1

Добавьте следующий код в.htaccess

RewriteEngine on
 RewriteCond $1
 !^(index\.php|resources|robots\.txt)
 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
 %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
  • 0
    этот код не работает для моего сайта

Ещё вопросы

Сообщество Overcoder
Наверх
Меню