错误路径 css 和 javascript


Error path css and javascript

我的网站上遇到了资源链接问题

举个例子:

站点地址(示例): www.abc.com/abc/xyx

正在加载的源 : www.abc.com/abc/style.css

链接到我的网站

这是 css 和 js 的加载路径错误。

这是 .htaccess 文件

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
 Options +FollowSymlinks
# Prevent Directoy listing 
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "'.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder
it does     run in ie. / becomes /shop/ 
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
 RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*'.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

我不知道为什么会错。我建立在Opencart上。

您的问题是由于.htaccess文件中提供的RewriteBase值造成的。在大多数情况下,这不是必需的,因此请从文件中删除RewriteBase /,您的 Web 服务器应该会猜出正确的路径

如果这不能解决问题,您需要将其更改为RewriteBase /abc/xyx/以匹配您网站的基础。然后,您的文件应该访问 css/js 的正确路径