gpt4 book ai didi

php - codeigniter 总是显示 404 错误 ubuntu 14.04

转载 作者:行者123 更新时间:2023-12-04 18:32:17 26 4
gpt4 key购买 nike

我在 windows(XAMPP) 中使用 codeiginiter 完成了一个项目,现在我将我的操作系统更改为 UBUNTU 14.04,并且我已经安装了 LAMP,LAMP 工作正常。

我将我的项目文件复制到/var/www/html 并将所有配置更改为 ububtu

$config['base_url'] = 'http://localhost/lankaproperty/';

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

路线
$route['default_controller'] = 'welcome';
$route['404_override'] = 'home/error_404';
$route['500_override'] = 'home/error_500';
$route['translate_uri_dashes'] = FALSE;

.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]

我还将所有文件权限更改为 755 ..

当我尝试这样的默认 Controller 时
http://localhost/lankaproperty/
它工作正常..

但其他 Controller 都没有工作

http://localhost/lankaproperty/home

http://localhost/lankaproperty/index.php?/home

我得到了错误。

`
404页面不存在

未找到您所请求的页面。
`
有人可以帮我解决这个问题 tnx ..

等/apache2/apache2.conf
    # Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>

<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

启用站点/000-default.conf
    <VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html



# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

站点可用/000-default.conf
    <VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html



# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

最佳答案

替换配置文件中这两个部分的值。

$config['base_url'] = 'http://localhost/lankaproperty/';
$config['index_page'] = 'index.php';


$config['base_url'] = '';
$config['index_page'] = '';

希望对你有用。

关于php - codeigniter 总是显示 404 错误 ubuntu 14.04,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29876923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com