.htaccess Codeigniter can';无法通过htaccess找到资源的相对路径

.htaccess Codeigniter can';无法通过htaccess找到资源的相对路径,.htaccess,codeigniter,resources,relative-path,.htaccess,Codeigniter,Resources,Relative Path,我正在使用codeigniter,我一直在使用css/js的路径,删除index.php和.htaccess。我试图加载我的资源,但我总是在我的 我的htdocs文件夹中有以下结构 Course | | Project | | js css .htaccess application | |

我正在使用codeigniter,我一直在使用css/js的路径,删除index.php和.htaccess。我试图加载我的资源,但我总是在我的

我的htdocs文件夹中有以下结构

Course
|
| 
 Project
       | 
       |
        js
        css
        .htaccess
        application
                  |
                  |
                  view
                     |
                     |
                     templates
                             |
                             |
                             footer.php
在我的footer.php中,我有

<script type="text/javascript" src="../../../js/script.js"></script>
在我的.htaccess中,我已经(通过这个,我能够从url中删除index.php,现在我浏览
http://localhost/course/project/profile
而不是
http://localhost/course/project/index.php/profile
)但这不是正确的方法,如中所述

但这给了我在控制台加载js资源时的错误

GET http://localhost/js/script.js 404 (Not Found) 
在上面的代码之前,我在我的.htaccess中有这个,就像他们网站上描述的那样

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ course/project/index.php/$1 [L]
但这是给我的

GET http://localhost/js/script.js 404 (Not Found) profile:80
当浏览到
http://localhost/course/project/profile
我要去

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我花了数小时跟踪和更改url、路径等,现在对此我感到很困惑。我希望有人能帮我做这件事?

你可以使用一些替代方案

没有PHP: 在标题中使用
base href
标记

<head>
   <base href="<?php echo base_url() ?>">
</head>

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
<head>
   <base href="<?php echo base_url() ?>">
</head>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="<?php echo site_url('js/script.js'); ?>"></script>