2015-10-17 108 views
0

我看了几个堆栈溢出问题,从子域删除index.php url请不要标记为重复。从子域codeigniter删除index.php 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笨3并启用MOD重写工作。我也使用虚拟主机。

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

没有运气进入内部服务器错误 – 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/