1

我已经安装了 ubuntu 12.04,并且我有运行 php 项目的完整要求(apache、mysql 和 php5)。不在 codeigniter 中的项目运行良好。在 codeigniter 中,当我加载项目时,默认控制器会加载 index_view 但当我单击其他控制器时;他们不会出现错误并显示错误

未找到 在此服务器上未找到请求的 URL /academic/login。

我意识到 .htaccess 不起作用;然后 /etc/apache2/httpd.conf 文件为空我想请求 httpd.conf 文件的基本配置示例,以便我的 htaccess 文件可以工作。如果有任何建议可以帮助我得出一些结果,我们将不胜感激。谢谢。我的 httaccess 在下面给出

RewriteEngine On
RewriteBase /

### Canonicalize codeigniter URLs

# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(platform(/index)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]

# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(localhost|academic) [NC]
RewriteRule ^(.*)$ http://localhost/academic/$1 [L,R=301]

# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]

###

# 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]

# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php

4

1 回答 1

1

这个值得信赖的人从来没有对我做错:

RewriteEngine On
RewriteBase /academic/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/ [L]
ErrorDocument 404 /index.php
于 2012-11-07T18:31:59.307 回答