What is the difference in operation between . and ^ and ^(.*)$?

独自空忆成欢 提交于 2019-12-02 05:30:55

First let's understand how landing page is matched.

For landing page URI pattern is ^$ in .htaccess, ^/$ in Apache config. Thus you can safely use ^/?$ universally.

  1. Your first rewrite rule will match every URL (including landing page i.e. http://domain.com/).
  2. Your second rewrite rule will match every URL (except landing page). As single DOT will not match ^$ URI pattern.
  3. Your third rewrite rule will also match every URL (including landing page i.e. http://domain.com) but has an unnecessary capturing group and longish version of just ^.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!