我在Opencart CMS上存储,我只是首席执行官,但现在想了解它是如何工作的:)。为此,我将其复制到本地网络服务器(macos 10.10.3,Apache / 2.4.10,mysql,php5.5)。在该网站打开的本地网络服务器上,您可以单击链接 - 它可以工作。但我有“购买”按钮和其他一些链接打开弹出窗口(购买信用卡,一键购买)的问题 - 它不起作用。我能做些什么让它有效?
当我打开产品页面时,在Chrome控制台中会出现以下错误:
carouFredSel: No element found for ".tabs-holder .product-holder:visible".
XMLHttpRequest cannot load 'http://localhost/index.php?route=product/product/review&product_id=209'. The request was redirected to 'http://localhost/index.php?route=product/product/review&product_id=209', which is disallowed for cross-origin requests that require preflight.
XMLHttpRequest cannot load 'http://localhost/index.php?route=record/record/captcham'. The request was redirected to 'http://localhost/index.php?route=record/record/captcham', which is disallowed for cross-origin requests that require preflight.
Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi)
点击“购买”按钮后,还要添加以下内容:
XMLHttpRequest cannot load 'http://localhost//index.php?route=checkout/cart/add'. The request was redirected to 'http://localhost/index.php?route=checkout/cart/add', which is disallowed for cross-origin requests that require preflight.
但如果我尝试使用以下选项在终端中打开Chrome:
open -a Google\ Chrome --args --disable-web-security
加载产品页面时没有任何错误,但按钮仍无效。
还有登录管理面板的问题 - 我打开'http://localhost/admin/',而不是输入login / psw(我多次检查 - 它是正确的)并且只是重新加载页面并要求输入再次登录/ psw。
我是网络编程的初学者,也许没有提供有关问题的信息 - 如果是这样,请告诉我还有什么我们需要解决这个问题,我会尝试找到它并在评论中写下来。 谢谢!
答案 0 :(得分:0)
我发现了问题 - 这是.htaccess中的这一行:
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L].
我已将其更改为
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
它有效!它有助于找到登录管理面板问题的解决方案。但我不明白为什么在虚拟服务器上一切正常,但在本地服务器上不起作用。