Question:
I have an example.com site that had a subdirectory called /lojanova.
This entire site has been migrated to the root of the main directory: "/".
For google there are still some images and files that are being directed to the wrong domain.
I would like to perform a 301 with htaccess so that all access is done, for example:
http://example.com/lojanova/category/product1.html
go to http://example.com/category/product1.html
It's possible?
Thanks in advance.
Answer:
Assuming mod_rewrite is enabled you can do the following in your .htaccess:
RewriteEngine on
RewriteBase /
RewriteRule ^lojanova/(.+)$ $1 [R=301,L]
RewriteRule ^lojanova(/)?$ / [R=301,L]
This will generate an http redirect 301 permanently moved from any URL "/lojanova/[something]" to "/[something]" or from "/lojanova" to "/".