I have some urls with the following structure :
https://www.example.com/name-of-a-page?specific_string-anything
I would like to redirect such urls to :
https://www.example.com/name-of-a-page
In other words, I would like to redirect urls containing a specific string, to the part of url located before the question mark.
I thank you in advance for any help in this matter.
Patrick
相关问题
- Improve converting string to readable urls
- Regex to match charset
- Regex subsequence matching
- Accommodate two types of quotes in a regex
- Set together letters and numbers that are ordinal
相关文章
- Optimization techniques for backtracking regex imp
- Regex to check for new line
- Allow only 2 decimal points entry to a textbox usi
- Comparing speed of non-matching regexp
- Regular expression to get URL in string swift with
- 请问如何删除之前和之后的非字母中文单字
- Lazy (ungreedy) matching multiple groups using reg
- when [:punct:] is too much [duplicate]
A simple regex to get matching that part would be
[^\?]+(?=\?)
.I can't give you any other information because I don't know what language you like to use.
EDIT:
According to the new information this should work in the
.htaccess
file:EDIT 2:
According to the latest information ;) the code should be this: