codeigniter删除index.php(可能的主机问题) [英] codeigniter removing index.php (possible problem with host)
问题描述
大家好,我在CodeIgniter中删除index.php时遇到一些问题。
我在本地创建了我的应用程序,但它工作正常, index.php似乎不工作。
我有一种感觉,这可能与我的主机有关,这不是最好的,我以前有问题。
所有我的CodeIgniter文件都位于一个子目录中服装。例如
< root> / outfitr /
我有.htaccess文件位于此文件夹中,并从CI维护中心获取:
EDITED
RewriteEngine On
RewriteBase / outfitr /
RewriteCond%{REQUEST_URI} ^ system。*
RewriteRule ^(。*)$ /index.php?/$1 [L]
RewriteCond%{REQUEST_URI} ^ application。*
RewriteRule ^ *)$ /index.php?/$1 [L]
RewriteCond%{REQUEST_FILENAME}!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^ )$ index.php?/ $ 1 [L]
更改我的config.php看起来像下面。我已经启用查询字符串,因为我需要他们为我的应用程序的一部分。
$ config ['base_url'] =< ; host> .com / outfitr /;
$ config ['index_page'] =;
...
$ config ['uri_protocol'] =PATH_INFO;
$ config ['enable_query_strings'] = TRUE;
任何帮助将是巨大的。正如我说的,我认为它可能与主机Fatcow有关。
我已经测试mod_rewrite,按照下一页的步骤,似乎启用。
http://www.wallpaperama.com/forums/how-to-test-check-if-mod-rewrite-is-enabled -t40.html解决方案确定所以经过一些试验和错误,我终于得到它的工作。我设置我的.htaccess文件如下。请注意RewriteRule中的'?'。
RewriteEngine On
RewriteBase / outfitr /
RewriteCond%{REQUEST_FILENAME }!-f
RewriteCond%{REQUEST_FILENAME}!-d
RewriteRule ^(。*)$ index.php?$ 1 [L]
然后在config.php中设置
$ config ['uri_protocol '] ='REQUEST_URI';
想想这是一些主机设置他们的mod_rewrite模块的方式。 Dreamhost和hostgator有相同的问题。
Hi everyone I'm having some problems when removing index.php in CodeIgniter.
I created my application locally and it works fine but when I uploaded it, removing index.php doesn't seem to work.
I have a feeling this could have something to do with my host, it's not the best and I've had problems before. It's hosted on Fatcow.
So..
all my CodeIgniter files are located in a sub-dirctory called outfitr. e.g
<root>/outfitr/
I have my .htaccess file located in this folder with the following taken from the CI wiki:
EDITED
RewriteEngine On RewriteBase /outfitr/ RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]
changes fo my config.php look like the following. I have enabled query strings as I need them for a section of my application.
$config['base_url'] = "<host>.com/outfitr/"; $config['index_page'] = ""; ... $config['uri_protocol'] = "PATH_INFO"; $config['enable_query_strings'] = TRUE;
Any help would be great. As I said I think it might have something to do with the host Fatcow.
I have tested mod_rewrite, following the steps on the following page and it seems to be enabled. http://www.wallpaperama.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html
解决方案ok so after some trial and error I finally got it working. I setup my .htaccess file as follows. Note the '?' in RewriteRule.
RewriteEngine On RewriteBase /outfitr/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?$1 [L]
Then in config.php I set
$config['uri_protocol'] = 'REQUEST_URI';
Think this is down to the way some hosts setup their mod_rewrite module. Dreamhost and hostgator have the same problem.
这篇关于codeigniter删除index.php(可能的主机问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!