.htaccess redirect folder to a url

By default, Redirect sort of maps the path node to a new path node, so anything after the first path gets appended to the target URL.

Try:

RedirectMatch 301 ^/abc/cba/ http://www.aaa.com/?

Or if you'd rather use mod_rewrite instead of mod_alias:

RewriteEngine On
RewriteRule ^/?abc/cba/ http://www.aaa.com/? [R=301,L]

here's another example of a mod_rewrite rule that worked for me

I wanted to redirect a sub directory to the root of the same domain.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^sub_directory/(.*)$ /$1 [R=301,NC,L]
</IfModule>

more examples can be found here:http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/


I had to reroute urls from old site version to new version, so here is what I did to reroute any links from about-us/* to about-us.html

RewriteEngine on
RewriteRule ^about-us/(.*)$ about-us.html [R=301,L]

What it doesn't do is rewrite something like domain.com/about-us/thing.html => domain.com/about-us.html .

It does work for things without extensions domain.com/about-us/something-in-url => domain.com/about-us.html

I added the lines below to redirect .jpg and .png, but it didn't work for .html, I can't find out why.

RewriteRule ^about-us/(.*).jpg about-us.html [R=301,L]
RewriteRule ^about-us/(.*).png about-us.html [R=301,L]

I perfer the following method:

 RewriteEngine on
 RewriteCond %{REQUEST_URI}  ^/somedir           [NC]
 RewriteRule /(.*) http://somesite.com/lost/$1 [R=301,L]