Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有符号链接的Codeigniter应用程序-从URL中删除index.php_Codeigniter - Fatal编程技术网

带有符号链接的Codeigniter应用程序-从URL中删除index.php

带有符号链接的Codeigniter应用程序-从URL中删除index.php,codeigniter,Codeigniter,我在网上浏览了这里和其他地方的许多资源,但似乎无法使其发挥作用。 我在主目录中有codeigniter应用程序。Sym链接在/var/www/html中创建。 下面的链接可以正常工作 http://mydomain.net/dms/index.php/welcome 但是如果没有index.php,我希望下面的链接能够正常工作 http://mydomain.net/dms/welcome 代码点火器2.1.1目录: dms application system i

我在网上浏览了这里和其他地方的许多资源,但似乎无法使其发挥作用。 我在主目录中有codeigniter应用程序。Sym链接在/var/www/html中创建。 下面的链接可以正常工作

http://mydomain.net/dms/index.php/welcome
但是如果没有index.php,我希望下面的链接能够正常工作

http://mydomain.net/dms/welcome

代码点火器2.1.1目录:

dms
    application
    system
    index.php
    .htaccess

Config.php

$config['index_page'] = ""; 
$config['uri_protocol'] = "AUTO";

routes.php

$route['default_controller'] = "welcome";

配置文件httpd.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
Alias /dms/ "/var/www/html/dms/"
<Directory "/var/www/html/dms">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

.htaccess文件:

RewriteEngine On
# enable symbolic links
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+) index.php [L]

我尝试将.htaccess文件保存在CI文件夹/home/user1/dms中,稍后保存在/var/www/html中 两者都不起作用。 我收到错误(在http错误日志中)


请帮助。

我使用这个.htaccess,它对我有效,请尝试:

   <IfModule mod_rewrite.c>
        # Make sure directory listing is disabled
        Options +FollowSymLinks -Indexes
        # disable the Apache MultiViews directive if it is enabled on the server. It plays havoc  with URL rewriting
        Options -MultiViews
        RewriteEngine on

        <IfModule mod_php5.c>
            RewriteRule ^(.*)$ index.php/$1 [L]
        </IfModule>

        <IfModule !mod_php5.c>
            RewriteRule ^(.*)$ index.php?/$1 [L]
        </IfModule>

    </IfModule>

#确保目录列表已禁用
选项+FollowSymLinks-索引
#如果在服务器上启用了Apache MultiView指令,请禁用该指令。它会破坏URL重写
选项-多视图
重新启动发动机
重写规则^(.*)$index.php/$1[L]
重写规则^(.*)$index.php?/$1[L]

我将codeigniter应用程序目录中的.htaccess文件更改为您上面给出的文件。现在我得到500个内部错误。日志文件显示-由于可能的配置错误,请求超出了10个内部重定向的限制。如有必要,使用“LimitInternalRecursion”增加限制。有什么提示吗?RewriteRule^([^/]*)$index.php/$1[L]和RewriteRule^([^/]*)$index.php?/$1[L]有效。Thank.htaccess文件,由Christian Giupponi提供,下面有我在评论中提到的更正。在服务器级别不需要AllowOverride All,但在特定目录级别必须如此。谢谢
"File does not exist: /var/www/html/dms/welcome"
   <IfModule mod_rewrite.c>
        # Make sure directory listing is disabled
        Options +FollowSymLinks -Indexes
        # disable the Apache MultiViews directive if it is enabled on the server. It plays havoc  with URL rewriting
        Options -MultiViews
        RewriteEngine on

        <IfModule mod_php5.c>
            RewriteRule ^(.*)$ index.php/$1 [L]
        </IfModule>

        <IfModule !mod_php5.c>
            RewriteRule ^(.*)$ index.php?/$1 [L]
        </IfModule>

    </IfModule>