Last active
September 6, 2023 11:39
-
-
Save liaotzukai/8e61a3f6dd82c267e05270b505eb6d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
<IfModule mod_negotiation.c> | |
Options -MultiViews | |
</IfModule> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} -d [OR] | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteRule ^ ^$1 [N] | |
RewriteCond %{REQUEST_URI} (\.\w+$) [NC] | |
RewriteRule ^(.*)$ public/$1 | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ server.php | |
</IfModule> |
THIS WORKS FOR ME IM USING LARAVEL 5.6
1.- I CREATE A NEW FILE IN MY ROOT DIRECTORY OF MY PROJECT CALL IT ".htaccess"
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
2.- I pasted this piece of code on my new file, refresh the browser and thats it.
Whats the problem: I had the problem: subdomain.domain.com/name-project/public/
The result I want ♥: And it woks! I have the solution The result: subdomain.domain.com/name-project/
Thanks @liaotzukai ♥
@liaotzukai Do you know how this code would look like for OpenLiteSpeed web server?
There are many guides that recommend enabling .htaccess support inside OLWS configuration, but I would like to avoid using access files, and add the rules directly inside virtual host config file.
There are not many online guides regarding Laravel and OLWS...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems to work great in Laravel 8. The only one I found! Thanks!