How to redirect only when exact url matches?

后端 未结 2 2038
名媛妹妹
名媛妹妹 2021-01-31 03:21

I\'m trying to redirect with apache .htaccess. I have the following codes

redirectMatch 301 /user http://clients.mydomain.com

it works pretty w

2条回答
  •  被撕碎了的回忆
    2021-01-31 03:23

    Use a regex, you're already using redirect match.

    http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirectmatch

    '$' matches the end of the url. In your example:

    redirectMatch 301 ^/user/(.+)$ http://clients.example.com/
    

提交回复
热议问题