开发者

htaccess - match ANY URL (in the same domain)

开发者 https://www.devze.com 2023-02-11 20:32 出处:网络
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.

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

精彩评论

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