0

我在网上和其他地方浏览了许多资源,但似乎无法让它发挥作用。我在主目录中有 codeigniter 应用程序。符号链接在 /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['index_page'] = ""; 
$config['uri_protocol'] = "AUTO";

路由.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>

符号链接

ls -l /var/www/html
dms -> /home/user1/dms

.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 错误日志中)

"File does not exist: /var/www/html/dms/welcome"

请帮忙。

4

1 回答 1

0

我使用这个 .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>
于 2013-07-28T10:04:33.950 回答