301 redirect
-
Hi again,
We set up an example page for you with working tests and links to example code and zipped version.
Hope that is what you need,
Sha
-
the ^ symbol means the begins with, the $ means ends with
so ^thisword$ means the URL must be a exact match "thisword"
try simply thisword
-
Thank you a lot for your help, very much appriciated
-
Thanks, Alan. Not really like that, as my url contains additional characters both in the front and at the end of the word. By the way the links you sent me on the topic were great I am just having some hard time to understand them, they are a bit chinese to me, as I have no basics at all writing htaccess.
-
Did you try it, it works for me.
Just try simply thisword
it should match aaaathiswordaaaaa
this will work,
[a-z]thisword [a-z]
but so will
thisword
-
still not working for me.
The exact url is domain.com/?score=4&rew=25 (there are some more versions of course with different counters)
I want to redirect all urls like this to domain.com
tried:
RedirectMatch 301 /[a-z]score[a-z] http://domain.com
RedirectMatch 301 /.score. http://domain.com
RedirectMatch 301 /^score$.* http://domain.com
RedirectMatch 301 /.^score$.* http://domain.comnone of them woks
-
i work on microsoft servers, so i am not sure about the sytax of htaccess.
but the regex is the same.
please try these.
RedirectMatch 301 [a-z]score[a-z] http://domain.com
RedirectMatch 301 score http://domain.comyou missed the *
-
Still not working for me. I tried further with:
RedirectMatch 301 [.]score[.] http://domain.com (I thought a-z stands just for letter and urls contain number and marks)
RedirectMatch 301 [.]score[.] http://domain.comneither works
-
You are correct, give me a munite and ill get back to you
-
try [a-z,0-9]score[a-z,0-9]
-
[a-z,0-9,=,&]alan[a-z,0-9,=,&]
get the idea
-
Here this will select your whole url
[a-z,0-9,=&?/.]score[a-z,0-9,=&]
-
nothing works. maybe I'll try posting another thread.
-
Well that will select your url, but what are you trying to do with it.
i have it working on IIS server using that regex, but i cant tell you how to use it in htaccess, as i dont use it
-
Thanks for the help. Regretfully this is my very first time writing htaccess so lot of faults can occur. I posted another thread maybe someone knows better than I do. Thank you very much for your time.
-
Hi Zsolt,
Did you actually look at the link I gave you with the code that you needed?.
The answer is to stop trying to use Redirectmatch and use the code I gave you in that example:
RewriteEngine on RewriteBase /score RewriteCond %{QUERY_STRING} score= RewriteRule ^/*$ newlocation.html? [R=301,L]This is the simplest, cleanest, and most reliable solution to your problem.
Sha
-
Yes, Sha looked at it and got a bit lost at once. I am totally new to server side codes and it needed a little modification but i got it working in the end. Thanks a lot.
-
Glad you got it worked out

Don't forget if you need extra help on something you can always use the Private Message system in your profile to contact people direct.
Have a great weekend,
Sha
-
well done sha, i am afraid i got the wrong end of the stick, i thought he wanted to SELECT the url, not simply detect it.