Redirecting non-www URL to www using .htaccess

后端 未结 7 1513
悲&欢浪女
悲&欢浪女 2021-01-05 12:04

I\'m using Helicon\'s ISAPI Rewrite 3, which basically enables .htaccess in IIS. I need to redirect a non-www URL to the www version, i.e. example.com should redirect to ww

7条回答
  •  借酒劲吻你
    2021-01-05 12:12

    Zigdon has the right idea except his regex isn't quite right. Use

    ^example\.com$

    instead of his suggestion of:

    ^example\.com(.*)

    Otherwise you won't just be matching example.com, you'll be matching things like example.comcast.net, example.com.au, etc.

提交回复
热议问题