如何从codeigniter在Ubuntu中删除的index.php [英] How to remove index.php from codeigniter in UBUNTU

查看:190
本文介绍了如何从codeigniter在Ubuntu中删除的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题是被问则已,我尝试了所有这些,但仍无法从URL中删除的index.php。 这里是我的个人资料

I know this question is being ask already, i tried all those but still unable to remove index.php from url. Here are my details

Ubuntu 12.10
PHP : 5.4.6
Mod_rewrite in on
CI verson: 2.1

.htacess如下:

.htacess look like:

RewriteEngine On
RewriteBase /projectname

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]  

我也看看下面的链接,但没有运气.. <一href="http://stackoverflow.com/questions/11580970/cannot-remove-index-php-from-url-ci-based-site">Cannot删除URL CI基础的网站的index.php

I also look at the below link but no luck.. Cannot remove index.php from url CI based site

如何删除&QUOT;的index.php&QUOT;在codeigniter的路径

我的/ etc / apache2的/站点可用/ default是这样的:

My "/etc/apache2/sites-available/default" is look like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None 
        </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

任何帮助AP preciated !!

Any help appreciated!!

推荐答案

的application / config / config.php文件的变化:

$config['index_page'] = 'index.php';

$config['index_page'] = '';

这是一个好主意,做阿帕奇重装每次你改变了Apache的配置文件。

it is a good idea to do apache reload everytime you change an apache config file.

sudo /etc/init.d/apache2 reload

sudo service apache2 reload

sudo /etc/init.d/httpd reload

(或者是等效的命令所用平台)

(or whatever is the equivalent command for your platform)

有什么是值得的,这是我的.htaccess

for what it is worth, here is my .htaccess

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|static|robots\.txt|favicon\.ico|uploads|googlexxxxxxxx\.html|mobile.html)
RewriteRule ^(.*)$ index.php/$1 [L]

这篇关于如何从codeigniter在Ubuntu中删除的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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