将网站复制到本地服务器后,"buy"、"buy in one click" 按钮不起作用
After copy the website to a local server, "buy", "buy in one click" buttons don't work
我在 Opencart CMS 上有商店,我只是 CEO,但现在想了解它是如何工作的:)。为此,我将它复制到本地网络服务器(macos 10.10.3、Apache/2.4.10、mysql、php5.5)。在站点打开的本地网络服务器上,您可以单击链接 - 它有效。但是我遇到了 "buy" 按钮和其他一些打开弹出窗口 windows 的链接的问题(信用购买,一键购买)- 它不起作用。我该怎么做才能让它发挥作用?
当我打开产品页面时,在 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)
在我点击"Buy"按钮后,还要添加这个:
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(我检查了很多次 - 它是正确的),然后重新加载页面并要求再次输入 login/psw。
我是 web 编程的初学者,可能提供的问题信息很少 - 如果是这样,请告诉我我们还需要什么来解决这个问题,我会尝试找到它并将其写在评论中。
谢谢!
我发现了问题 - 这是 .htaccess 中的这一行:
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/ [R=301,L].
我已经改成了
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/ [R=301,L]
而且有效!它有助于找到解决登录管理面板问题的方法。但我不明白为什么在虚拟服务器上一切正常,但在本地服务器上不起作用。
我在 Opencart CMS 上有商店,我只是 CEO,但现在想了解它是如何工作的:)。为此,我将它复制到本地网络服务器(macos 10.10.3、Apache/2.4.10、mysql、php5.5)。在站点打开的本地网络服务器上,您可以单击链接 - 它有效。但是我遇到了 "buy" 按钮和其他一些打开弹出窗口 windows 的链接的问题(信用购买,一键购买)- 它不起作用。我该怎么做才能让它发挥作用?
当我打开产品页面时,在 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)
在我点击"Buy"按钮后,还要添加这个:
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(我检查了很多次 - 它是正确的),然后重新加载页面并要求再次输入 login/psw。
我是 web 编程的初学者,可能提供的问题信息很少 - 如果是这样,请告诉我我们还需要什么来解决这个问题,我会尝试找到它并将其写在评论中。 谢谢!
我发现了问题 - 这是 .htaccess 中的这一行:
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/ [R=301,L].
我已经改成了
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/ [R=301,L]
而且有效!它有助于找到解决登录管理面板问题的方法。但我不明白为什么在虚拟服务器上一切正常,但在本地服务器上不起作用。