George Mylonas George Mylonas - 25 days ago 7
Apache Configuration Question

Rewrite URL on .htaccess

I have urls like

www.example.com/de/something
and I need to redirect to
www.example.com
everything that starts with
/de/
.

At the moment I have done this

redirect 301 /de http://example.com


and it redirect all links but just removing
/de
part and result is
www.example.com/something
.

How to fix this?

Thanks

Answer

redirect directive matchs rest of the uri and appends it to the target, you can use RedirectMatch to redirect a specific uri

redirectMatch 301 ^/de/? http://example.com
Comments