How to install Laravel to a subdirectory

Simple! Just need to change a setting in the .htaccess file. I am using Laravel 4, you might be using some other version but the method should apply nevertheless. I use an alias to point to this directory.

Add this line “RewriteBase /l4″ to your .htaccess where l4 is your sub directory or folder.

[code language=”php”]<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /l4
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>[/code]

Have fun!

How to enable Apache mod rewrite in Ubuntu

Actually this probably works for all Linux distributions with Apache 2. Okay enabling mod_rewrite is really easy, you just have to use a2enmod (Apache 2 enable module):

[code lang=”bash”]sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart[/code]

To disable an Apache 2 module, you can run:

[code lang=”bash”]sudo a2dismod rewrite
sudo /etc/init.d/apache2 restart[/code]

That does the reverse.

With mod_rewrite enabled, you can use the .htaccess file.

By the way in your directory permissions, you must set AllowOverride to “all” like this:

[code lang=”ini”]
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
[/code]

Hope it helps.