Opencart SEF废墟相对链接

时间:2017-02-03 19:45:46

标签: php .htaccess url-rewriting opencart sef

我的Opencart网站在SEF模式下无法加载文件且类别名称在网址中。 例如,当我在这个URL中时:

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

页面中的相对网址:

image/globe.png

应该像这样编译:

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

但是浏览器无法加载它,因为它编译如下:

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

我的htaccess文件未经编辑,它等于Github版本:

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

任何人都知道解决方案吗?

1 个答案:

答案 0 :(得分:3)

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

其他您可以在页面的<head>部分HTML <base href="/" />下方添加此内容,以便每个相对网址为从该基本网址解析而不是从当前网页的网址解析。

相关问题