如何强制非www当人访问网站专卖店 [英] how to force non-www when person visits website store

查看:215
本文介绍了如何强制非www当人访问网站专卖店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的网站的脚本是一个模块插件的op​​encart。我试图在与开发商,但是这是他告诉我的。

  

浏览器将阻止Ajax请求的跨域请求。   这是多么的脚本和浏览器上运行它无关   我mod。你需要把重定向在你的.htaccess,以确保   人们总是风上正确的域非www。

  

他们是Ajax请求。我不知道你将如何启用它们   跨域支持。

问题是pretty的多,当我打开我的网站,我有一个脚本。一个汽车制造商,型号,年份选择器,它为某些人而不是其他人。我意识到这是与WWW。盈方的域。当WWW。被删除它适用于每一个人,当它被添加它停止工作的每一个人。

有没有办法迫使非www。在我的网站商店目录中的 /存储/

我也试过,但它说的错误

  

的页是不正确重定向浏览器检测到   服务器重定向该地址的请求的方式,将   永远不会完成。

 的RewriteCond%{HTTP_HOST} ^(WWW \)(+)[OR]
的RewriteCond%{} HTTPS关闭
的RewriteCond%{HTTP_HOST} ^(WWW \)?(+)
重写规则^ HTTP://%2%{REQUEST_URI} [R = 301,L]
 

解决方案
  

有没有办法迫使非www。在我的网站存放目录/存储/

您可以在 DOCUMENT_ROOT /的.htaccess 文件中使用此code:

  RewriteEngine叙述上

的RewriteCond%{} HTTPS关闭
的RewriteCond%{HTTP_HOST} ^ WWW \。(。+)$ [NC]
重写规则^店(/.*)?$的http://%1%{REQUEST_URI} [R = 301,L,NC,NE]
 

I have a script on my website that is a module addon for opencart. I tried working with the developer but this is what he told me.

The browser will block the ajax request as a cross domain request. This is just how scripts and browsers work it has nothing to do with my mod. You need to put a redirect in your .htaccess to make sure that people always wind up on the proper domain non-www.

and

they are are ajax requests. I'm not sure how you would enable them for cross domain support.

The issue is pretty much when I load my website, i have a script. a car make, model, year chooser, it works for some people and not for others. I realized it was with the www. infront of the domain. When the www. is removed it works for everyone, when it is added it stops working for everyone.

Is there a way to force non-www. on my website store directory /store/

I have tried this but it says an error

The page isn't redirecting properly Browser has detected that the server is redirecting the request for this address in a way that will never complete.

RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ http://%2%{REQUEST_URI} [R=301,L]

解决方案

Is there a way to force non-www. on my website store directory /store/

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^store(/.*)?$ http://%1%{REQUEST_URI} [R=301,L,NC,NE]

这篇关于如何强制非www当人访问网站专卖店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆