codeigniter删除index.php(可能的主机问题)

编程入门 行业动态 更新时间:2024-10-13 04:18:55
本文介绍了codeigniter删除index.php(可能的主机问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好,我在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> / outfitr /; $ config ['index_page'] =; ... $ config ['uri_protocol'] =PATH_INFO; $ config ['enable_query_strings'] = TRUE;

任何帮助将是巨大的。正如我说的,我认为它可能与主机Fatcow有关。

我已经测试mod_rewrite,按照下一页的步骤,似乎启用。 www.wallpaperama/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>/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. www.wallpaperama/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(可能的主机问题)

本文发布于:2023-11-02 03:49:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551286.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主机   codeigniter   index   php

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!