开发者

htaccess - match ANY URL (in the same domain)

I want to rewrite URLs using .htaccess

I want mod_rew开发者_如何学JAVArite to match ANY URL and then rewrite it to something else. By ANY URL, I mean URLs inside the same domain.

Examples of ANY URL:

  • example.com
  • example.com/index.php
  • example.com/images/background.png
  • example.com/foo/bar/
  • example.com/?page=10
  • example.com/some/some/url/inside/this/domain/
  • example.com/foo/?bar=22

I want the regexp to match ANY of the above URLs. What is the regexp that I should use?


RewriteCond %{HTTP_HOST} ^(example.com|www.example.com)
RewriteRule ^(.*)$ /some-target-page.html[L,QSA]

^ means start and $ means end

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜