Removing directory from url using htaccess

Hi, our website www.evolve.uk.net runs on MODx Revolution and uses the friendly urls feature. In order to create 3 menus i’ve created virtual directories in MODx, but this unfortunately leads to them being included in the URL. Browsing the website you will notice /main-menu/ and /utilities-menu/ is included.

What I need to do is remove these from the URL using htaccess. I’ve been trying all afternoon but with no luck. The closest I came is this, which did remove the directory, but every page redirected me back to the home page…

RewriteRule ^main-menu/(.*)$ http://www.evolve.uk.net/$1 [R=301,L]

Any ideas please? Thank you

Thanks David, further to your response I tested my code on a plain html site and it works perfectly. It is obviously the MODx CMS, or something else in the .htaccess file preventing the code working. Thanks, Andy

ec,

The redirection is displayed for two reasons:

  1. R=301

  2. http://

EITHER will cause the redirection to be displayed.

As for your “redirected back,” is that your 404 response? I would expect that of virtual directories as Apache has no knowledge of whatever else is going on with your coding.

Regards,

DK