开发者

htaccess redirect regex

开发者 https://www.devze.com 2023-03-27 11:20 出处:网络
I want to write a regex to redirect JUST http://www.domain.com/pages, not for any other subdirectories like http://www.domain.com/pages/page1.

I want to write a regex to redirect JUST http://www.domain.com/pages, not for any other subdirectories like http://www.domain.com/pages/page1.

I was thinking about these 2 solutions, but as I am not good at writing regex, I can just describe it.

a) I need to 开发者_StackOverflow中文版write a regex, that will return true only if the searched sub-string pages is at the very and of an URL.

OR

b) I need to write a regex, that will return true only if the searched sub-string is exactly same as the URL, so I will search for http://www.domain.com/pages.

OR do you have any other ideas how to solve this?


as always with regexp's - ^ marks beginning of the string, $ marks the end

RewriteRule ^/pages$ target [l]
0

精彩评论

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