URL rewriting to hide a folder


#1

Hi everyone,

I’m searching now for few days and I’m new to URL rewriting.

I would like to write a rule which hide a folder and the file extension. Per example, we have mydomain.com/f1/f2/document.html, I would like to show mydomain.com/f1/document

I wrote a rule which works on my local web server under a xampp environment. But it doesn’t work on “My Crazy Domain Insane” plan.

I wrote it :

Options -Indexes +FollowSymLinks
RewriteEngine on

RewriteCond %{REQUEST_URI} !/content/
RewriteRule ^(.)/([^/]+)$ - [E=CONTENT_URL:/$1/content/$2.html]
RewriteCond %{DOCUMENT_ROOT}%{ENV:CONTENT_URL} -f
RewriteRule .
%{ENV:CONTENT_URL} [L]

Does anyone have an idea?

Kind regards,

bbp.