在实时服务器上无法识别基本路径

时间:2013-09-06 11:24:11

标签: codeigniter path base-url

我的媒体文件夹路径(css)在localhost上工作正常但在实时服务器上它无法识别它。所有我改变的是index.php中的系统和应用程序路径到网站/系统和网站/应用程序。 URL-helper是自动加载的。 Base_url设置为http://website.com/

这是文件夹结构:

根文件夹:Apache日志,错误日志,网站

网站文件夹:应用程序,媒体,系统

媒体文件夹:css

CSS-File:style.css

这是例如我的css包含:

<link rel="stylesheet" type="text/css" href="<?php echo base_url('media/css/style.css'); ?>" />

当我在内部包含css时,它可以工作,因此它绝对是一个路径问题。我用base_url尝试了几件事,但是没有成功。谢谢你的帮助!

我的.htaccess文件:

Options -Indexes
Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php
php_flag short_open_tags on

<IfModule mod_rewrite.c>
    # mod_rewrite rules
    RewriteEngine on

    # The RewriteBase of the system (if you are using this sytem in a sub-folder).
    #RewriteBase /cmp/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .$ index.php/$1 [L,QSA]
</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

2 个答案:

答案 0 :(得分:1)

您需要将Website文件夹的内容移至root并尝试一次。

答案 1 :(得分:0)

试试这个

<link rel="stylesheet" type="text/css" href="<?php echo base_url().'media/css/style.css'; ?>" />