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 http://tutorials.scrisoft.com/folder/ and you want to get only http://tutorials.scrisoft.com/, 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 http://tutorials.scrisoft.com/folder/ to http://tutorials.scrisoft.com/

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









Leave a Comment