无法在Web服务器中托管codeigniter项目

时间:2015-04-24 05:08:20

标签: .htaccess codeigniter

我在codeigniter中创建了一个Web项目。在我的localhost(Windows 7)中,我可以运行该项目,没有任何错误。但是当我尝试在我的大学子域中托管我的项目时(管理员给了我一个子域来托管我的文件myproject.university.edu.bt)。我通过filezilla上传了所有文件。当我尝试访问以登录页面开头的页面时。它显示登录按钮,没有我为站点编码的任何样式。单击登录按钮而不是显示下一页时,它会给我一个错误The requested URL /sasec/login/user_login was not found on this server. Can any正文告诉我应该怎么做才能正确查看/显示我的页面!这是我的.htaccess文件。大学服务器在linux上运行

  <IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On

# If your website begins from a folder e.g localhost/my_project then 
# you have to change it to: RewriteBase /my_project/
# If your site begins from the root e.g. example.local/ then
# let it as it is
RewriteBase /

# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin
    ErrorDocument 404 /index.php
</IfModule>

2 个答案:

答案 0 :(得分:1)

你可能需要用

改变一些东西
RewriteBase /

在你的htaccess文件中,下面给出的链接会给你更多的想法。

https://www.daniweb.com/web-development/php/threads/435526/codeigniter-remove-index-php-while-working-on-virtual-host-on-xampp

由于 阿米特

答案 1 :(得分:1)

转到config/routs.php

更改此

$route['default_controller'] = '';//give your default controller name
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

另外

路径 - config/config.php

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