我已经看过一些从index.php子域删除 url的堆栈溢出问题,请不要标记为重复。
我读过并尝试过堆栈溢出。
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重写。此外,我使用虚拟主机。
问题:,什么是适合子域的最合适的htacces,这样我就可以让index.php删除?
页面错误:
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当我有像下面这样的WAMP上的URL时,不起作用。
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'] = '';下面这个.htaccess位于主目录上,对主域很好。
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]发布于 2015-10-17 09:38:30
用这个:
<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>发布于 2015-10-17 10:00:37
替换您的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/
https://stackoverflow.com/questions/33185016
复制相似问题