Forum Moderators: phranque
I need to redirect three folders located to the root of my website, these are named: pelio, halkidiki and athens. All three folder contain numerous sub-folders and hunderds of files so wht I need is a mass 301,L redirection, is this feasible? Can it be done by using the rules below?
RewriteRule ^/athens $http://www.mysite.com/attica/athens [R=301,L]
RewriteRule ^/pelion $http://www.mysite.com/thessaly/pelion [R=301,L]
RewriteRule ^/halkidiki $http://www.mysite.com/macedonia/halkidiki [R=301,L]
Would these rules above include all sub-folders and files thus delivering a mass redirection?Is there a better way?
Thx in advance!
RewriteRule ^/athens[b](.*)[/b] $http://www.mysite.com/attica/athens[b]$1[/b] [R=301,L]
RewriteRule ^/pelion(.*) $http://www.mysite.com/thessaly/pelion$1 [R=301,L]
RewriteRule ^/halkidiki(.*) $http://www.mysite.com/macedonia/halkidiki$1 [R=301,L]
If this code is for use in .htaccess instead of httpd.conf, omit the leading slash on the patterns. That is, use "^athens" instead of "^/athens", for example.
Jim
I have already seen the mod_rewite documentation and from there I found the way to create these rules. Since they will be used in htaccess and not httpd.conf as you mention they will be :
RewriteRule ^athens(.*) $http://www.mysite.com/attica/athens$1 [R=301,L]
RewriteRule ^pelion(.*) $http://www.mysite.com/thessaly/pelion$1 [R=301,L]
RewriteRule ^halkidiki(.*) $http://www.mysite.com/macedonia/halkidiki$1 [R=301,L]
Thx again, my only matter was if these rules would be fine for the rest of folders and subfolders that apply after the $1 i.e. (athens/images/acropole/image1.jpg), now I know that it will work for all folders and subfolders!Thx again!