Lauren Eccles Lauren Eccles - 1 year ago 109
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

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download