Forum Moderators: phranque
The story:
I'm using the following line to redirect visitors from "http://www.domain.com/targetfolder/foo" to "http://www.domain.com/linking/link.php?keyword=foo" :
###############
RewriteRule ^targetfolder/([-_A-Za-z0-9]+)$ linking/link.php?keyword=$1
###############
As you can see: "targetfolder" and "linking" folders both located in the root directory.
But sometimes, somehow Joomla generated URL looks like: "http://www.domain.com/anotherfolder/targetfolder/foo" and definitely visitor getting Error 404 Page clicking on that link.
My question:
How RewriteRule should looks like to catch any URLs with "targetfolder" inside and redirect to "linking" folder?
Please advice
Thanks in advance
RewriteRule [b]^([^/]+/)?t[/b]argetfolder/([-_A-Za-z0-9]+)$ /linking/link.php?keywor[b]d=$2 [L][/b]
Jim
Totally agree with you. I'm working on duplicate content issue, but at the same time, I decided (just in case) to have a generic RewriteRule to cover all possible cases ... Am I right?
BTW, Your rule is working perfect, just small wish: is it possible to change RewriteRule to open "_blank" page ( I don't want to lose a visitor)?
Thank you very much again for your support
Oleg
See the references cited in our forum charter [webmasterworld.com] for more information on regular expressions.
Jim