Forum Moderators: phranque
The site was laid out as such:
http://www.example.com/oldfolder/
What I want is that any url going to oldfolder, to go to newfolder as such:
http://www.example.com/newfolder/
This is my apache virtual host code, but it doesn't seem to be doing anything at all:
RewriteRule ^/oldfolder/$ http://www.example.com/newfolder/$ [R=301,L]
Is it because I do not have a RewriteCond?
Assuming that this code is in httpd.conf, try:
RewriteRule ^/oldfolder[b]/(.*)$[/b] http://www.example.com/newfolder[b]/$1[/b] [R=301,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
My last question would be, why doesn't it actually rewrite the url? I mean, the only reason I would care is for SEO reasons..Not sure if it even matters though. The url still shows oldfolder in the address bar, yet it definitely redirected to newfolder....
In this case, if /oldfolder/foo.html is cached in your browser and you request it again, the browser will render that page from its cache, and no request will be sent to your server. Therefore, the rule can have no effect.
Jim