How to allow the installation of other applications in subdirectories

The Laravel framework uses resourceful URLs to handle requests. This makes your URLs look better and are more SEO friendly.

This type of URLs requires the usage of an Apache web server module called mod_rewrite. Mod_rewrite rules are specified in the .htaccess configuration file.

NB!
The options and rules specified in this file are valid for the current directory in which the file is placed and for all its subdirectories.

NB!
.htaccess is a hidden file as well as all the files starting with a dot in Linux operating systems.

To be able to see .htaccess file log in to your cPanel and click on the File Manager tool.

Then click on Settings and choose the “Show hidden files” option.

After that navigate to the .htaccess file and edit it with right clicking on it and press “edit” or “code edit”.

For example if you want to install a forum application in a subdirectory of your Laravel application called “forum” you’ll have to add the following rule:

RewriteCond %{REQUEST_URI} !^/forum

This will do the trick if your Laravel installation is located in your webroot in the public_html. Therefore it opens directly with your url and is not located in a subdirectory.

WebHostFace

Share
Published by
WebHostFace