• 第九区帐号
  • 帐号购买 1元体验

活到老学到老  

记录遇到问题的点点滴滴。

apache 不带www重定向到www域名

8年前发布  · 1569 次阅读
  apache  RewriteRule 

强制跳转到www域名

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

强制跳转到不带www域名

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
搜索
文章分类
  • ├Php
  • ├----Yii2
  • ├----CodeIgniter
  • ├----Library
  • ├----Smarty
  • ├Linux
  • ├----CentOS
  • ├----Ubuntu
  • ├----OpenWrt
  • ├----Vps
  • ├Web
  • ├----JavaScript
  • ├--------AngularJs
  • ├----Css
  • ├----HTML5
  • ├Java
  • ├----Android
  • ├Database
  • ├----Mysql
  • ├其他
  • ├Server
  • ├----Apache
  • ├----Nginx
  • ├----Tomcat
  • ├Windows
  • ├Ruby
  • ├----Ruby on Rails
  • ├设计模式
  • ├Python
  • ├硬件
  • ├电子商务
  • ├Raspberry Pi(树莓派)
  • ├NodeJs
  • ├Photoshop
  • ├Mac
  • ├IOS
  • ├React
  • ├----React Native
文章归档
2018年1月 (7) 2017年12月 (3) 2017年11月 (6) 2017年9月 (14) 2017年8月 (16) 2017年7月 (15) 2017年6月 (12) 2017年5月 (27) 2017年4月 (11) 2017年3月 (17) 2017年2月 (26) 2017年1月 (12) 2016年12月 (3) 2016年10月 (5) 2016年9月 (20) 2016年8月 (37) 2016年7月 (46) 2016年6月 (28) 2016年5月 (46) 2016年4月 (71) 2016年3月 (40) 2016年2月 (22) 2016年1月 (28)

© 2025 第九区