简体   繁体   English

htaccess重写未更改浏览器地址栏

[英]htaccess Rewrite is Not Changing Browser Address Bar

I feel like I'm missing something here. 我觉得我在这里想念什么。 We originally used a subdomain (m.example.com) for mobile traffic. 我们最初使用子域(m.example.com)进行移动流量。 We now wish to stop using that, and we'd like all users who visit an m.example.com page to be redirected simply to example.com. 现在,我们希望不再使用它,我们希望将访问m.example.com页面的所有用户直接重定向到example.com。 Everything seems to work fine, however the address bar in the browser never changes. 一切似乎都正常,但是浏览器中的地址栏永远不会改变。 If users type in m.example.com, that same domain remains in the address bar. 如果用户键入m.example.com,则该域仍保留在地址栏中。 What am I missing? 我想念什么? Here are the rewrites in my htaccess: 这是我的htaccess中的重写:

RewriteEngine on
  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]

  #custom redirects
  #RewriteCond %{HTTP_HOST} ^example.com
  #RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

You can use: 您可以使用:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^m\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=permanent,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM