Forum Moderators: phranque
but it's not working at all. It is between a few other rewrites that work so the error must be here
on the browser it shows with %20, and I tried with that too, but it still didn't work. What am I missing? I really don't want to lose about 10 or so deep links
Thanks,
I think there are a couple of things you can try...
I see you are escaping the space, so you might try \s. If that does not work you might need to get a little more creative.
What may work, and since you do not need to 'catch' the space in a variable is a simple regex that would make your rule look like this:
RewriteRule ^Word1[^a-z-]+Word2-keyword$ /word1-word2-keyword [NC,R=301,L]
The regular expression should kick in and catch the space because it matches anything that is not a letter or a '-'. It also should not impact your server load too much, because it is in the middle of the line and forward looking to what should be the next character to 'break' it.
Hope this helps.
Justin
Edited: Clarity and regex to include any character(s) up to the next letter.
strange
It still didn't work so I created a Word1%20Word2-keyword folder, with a index.php that gives a 301 to the new file. The only "problem" is that spiders first get a 301 to Word1%20Word2-keyword/ (with the / on end) and then one more 301 to the new file. Will they follow to 301s? I tried a spider simulator via "HTTP Viewer" and the followed it but I'll find out later if GoogleBot etc. do the same
thanks again,