我的网站上存在资源链接问题
举个例子:
网站地址(示例):www.abc.com/abc/xyx
正在加载的源:www.abc.com/abc/style.css
Link to my website
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上。
最佳答案
您的问题是由于RewriteBase
文件中提供的.htaccess
值引起的。在大多数情况下,这不是必需的,因此从文件中删除RewriteBase /
,您的Web服务器应猜测正确的路径
如果仍不能解决问题,则需要将其更改为RewriteBase /abc/xyx/
以匹配您的网站基础。然后,您的文件应访问css / js的正确路径