2

My Opencart website can't load files when it is in SEF mode and a categorie name is in the url . For example when i am in this URL :

http://thehouseofmarley.ir/speaker/nikon-d300

This relative URL in the page :

image/globe.png

Should compile like this :

http://thehouseofmarley.ir/image/globe.png

But The browser can't load it because that compiles like this :

http://thehouseofmarley.ir/speaker/image/globe.png

My htaccess file is unedited and it is equal to Github version :

https://github.com/opencart/opencart/blob/master/upload/.htaccess.txt

Anyone knows the solution?

4

1 回答 1

3

好的,现在您已经遇到了人们在切换到漂亮的 URL 方案时面临的最常见问题。解决方案也很简单,只需在您的 css、js、图像文件中使用绝对路径而不是相对路径。这意味着您必须确保这些文件的路径http://以 slash 或 slash开头/

否则<head>,您可以将其添加到页面 HTML 的下方:<base href="/" />以便每个相对 URL都从该基本 URL 解析,而不是从当前页面的 URL 解析。

于 2017-02-03T20:38:15.233 回答