codeIgniter子域文件夹,删除从地址的index.php [英] CodeIgniter in subdomain folder, removing the index.php from address

查看:89
本文介绍了codeIgniter子域文件夹,删除从地址的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我想使用本手册从地址中删除的index.php: HTTP ://dev.lohv.eu/1/user_guide/general/urls.html

So I am trying to remove index.php from address using this manual: http://dev.lohv.eu/1/user_guide/general/urls.html

ATM我有地址 http://dev.lohv.eu/1/index.php < /一>,但我想用它在未来没有index.php文件,就像这样: HTTP://dev.lohv .EU / 1 /

我按照说明书创建.htaccess文件:

I created .htaccess file according to manual:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

但unfortunaly失败,我得到404错误。我想这个问题是,我想配置的.htaccess子域文件夹,这样它不会适合作为人工,需要一些额外的,但我不知道是什么群众演员需要。

But unfortunaly it fails, I get 404 error. I guess the problem is, I am trying to configure .htaccess in subdomain folder so it wont fit as in manual and needs some extra, but I don't know what extras it needs.

推荐答案

我觉得你错过了一个?。 重写规则^(。*)$ /index.php?/$1 [L]

I think you're missing a '?'. RewriteRule ^(.*)$ /index.php?/$1 [L]

这是CI推荐的.htaccess模板(或者至少是一年前),而两者之间的主要区别。

This is CI's recommended .htaccess template (or at least it was a year ago), and that ? is the major difference between the two.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

这篇关于codeIgniter子域文件夹,删除从地址的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆