Redirect Laravel installation and blog using .htaccess

I have a Laravel website and a WordPress blog installed on a shared hosting and trying to implement the following:

Visiting should forward the request to a subdirectory public, without rewriting the url. This I have achieved by

RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

What I want to prevent is the user manually opening This should redirect the user to

The other issue that I have is that my blog is installed in public/blog folder. I want to be able to load the blog by visiting At the moment this is possible, but only if I type (with a trailing slash), otherwise it opens

Please advise me how to define the .htaccess file and if the folders structure is fine. Another idea that I had is to take the blog folder out of the public folder, which is part of Laravel and just have two separate folder in the root www folder.

Read more here: Redirect Laravel installation and blog using .htaccess

Leave a Reply

Your email address will not be published. Required fields are marked *