2015-10-17 5 views
0

Я просмотрел несколько вопросов переполнения стека для удаления index.php из поддомен URL-адрес, пожалуйста, не помечен как дубликат.Удаление index.php из поддомена codeigniter 3

Переполнение стека Я прочитал и испробовал.

CodeIgniter in subdomain folder, removing the index.php from address

remove index.php of codeigniter subdomains

Removing index.php and handling subdomains of two Codeigniter sites, when one within the other

Но не похоже на работу, я использую WAMP и Codeigniter 3 и включена MOD Rewrite. Также я использую виртуальный хост.

Question: What is the best suitable htacces for sub domain so that I can have the index.php remove?

Ошибка Страница:

codeigniter 500 internal server error 

Моя структура папок

www/
www/codeigniter/cms-1 <-- This is main project 
www/codeigniter/cms-1/application 

www/codeigniter/cms-1/cms-2 <-- This is sub domain 
www/codeigniter/cms-1/cms-2/index.php 
www/codeigniter/cms-1/cms-2/.htaccess 

www/codeigniter/cms-1/image/
www/codeigniter/cms-1/system 
www/codeigniter/cms-1/.htaccess 
www/codeigniter/cms-1/index.php 

Когда у меня есть URL на WAMP, как показано ниже, не работает.

http://www.cms-2.cms-1.com/information/information/3

Но когда у меня есть index.php работает.

http://www.cms-2.cms-1.com/index.php/information/information/3

Я извлекал на application > config > config.php

$config['index_page'] = ''; 

This .htaccess below is on Main directory and works fine for main domain.

Options +FollowSymLinks 

# Prevent Directoy listing 
Options -Indexes 

# Prevent Direct Access to files 

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))"> 
    Order deny,allow 
    Deny from all 
</FilesMatch> 

DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?$1 [L,QSA] 

ответ

3

Используйте это на:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 
+0

Не повезло не идет Internal Server Error – user4419336

+0

Обновлено проверку это сейчас –

+0

Спасибо за вашу помощь, я узнал, что было не так. + 1 – user4419336

1

Замените base_url

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){$ssl_set = "s";} else{$ssl_set = "";} 
$config['base_url'] = 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST']; 

В .htaccess

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 

Более прочитать http://w3code.in/2015/10/how-to-make-multiple-websitesubdomain-of-your-main-site-in-codeigniter-with-same-code-and-database-dynamically/