Ben Ben - 8 months ago 97
Apache Configuration Question

.htaccess directory wildcard redirect

Please can someone tell me why this isn't working?

I am trying to redirect all files within the directory "Kent". In this example the page to be redirected is "ramsgate" and change the folder structure.





Using a wildcard redirect, why doesn't this work?

RedirectMatch 301 /electrical-contractors/kent/(.*).php /electrical-contractors-$1/


Have this rule inside /electrical-contractors/kent/.htaccess:

RewriteEngine On

RewriteRule ^(.+)\.php$ /electrical-contractors-$1/ [L,NC,R=301]