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]
精彩评论