Htaccess tutorial: remove folder or subfolder from url

Hi guys! In this tutorial I will explain how you can remove a folder or a subfolder from url. As you know, with htaccess you can easily customize a url of a website.

If you have an url like and you want to get only, you must add this code in your htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !(.*)folder
RewriteRule ^(.*)$ folder/$1 [L]

With this code you will replace to

With this code you can hide web folder from Yii Framework, Symfony and other frameworks!

Leave a Comment