Lauren Eccles Lauren Eccles - 5 months ago 21
Apache Configuration Question

Remove subfolder from URL if the next subfolder is a specified subfolder (.htaccess)

For example:

This is fine:

This is also fine:

But if the subfolder after ecommerce is seo, remove ecommerce:

This is not fine:
and should be redirected to


Assuming there is no .htaccess in ecommerce/, you can use this rule in site root .htaccess:

RewriteEngine On

RewriteRule ^ecommerce/(seo)(/.*)?$ /$1$2 [L,NC,R=302]