berko Posted September 30, 2019 Report Share Posted September 30, 2019 Im trying to redirect 301 hundreds of error url under some category to my homepage except certain url to 410 Gone domain.com/Iklan/3262 >>>> should be 301 domain.com/Iklan/3264 >>>> should be 301 domain.com/Iklan/3265/?fb_comment_id=788343724 >>>redirect 410 domain.com/Iklan/3267??attachment_id=1082 >>>redirect 410 I found the htaccess code after browsing in internet redirectMatch 301 ^/Iklan/(.+)$ https://domain.com/ But it redirect url marked as 410 to domain.com/?attachment_id=1082 (it creates two redirect , 301 and then 410) And some of them are 404 ( the url above is just sample, theres hundreds of them)..im suspecting there's upper case or different char but im not sure I have weak eyes and i cant tell which on of the letter is using upper case Can anyone help me? Thanks Quote Link to comment Share on other sites More sharing options...
tgonhawk1 Posted October 4, 2019 Report Share Posted October 4, 2019 On 9/30/2019 at 8:24 AM, berko said: ^/Iklan/(.+)$ https://domain.com/ Your regular expression (above) matches the following: ^ -> means the start of the target, so the matches will have nothing before /iklan/. Something like /abc/iklan/ will not match. ( ) is for grouping, but that is not used here, so those are redundant .+ -> means one or more of any character $ -> means the end In summary, this will match anything starting with /iklan/ followed by one or more characters. It would appear that it is redirecting the URLs (the part before the ?'s) and preserving the query strings (the ? and what comes after). That accounts for the 301's. The 410's must arise from some other rule. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.