Stuck with this for a long time. I found similar questions but none of the answers are working for me! .htaccess in root folder looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
Stuck with this for a long time. I found similar questions but none of the answers are working for me! .htaccess in root folder looks like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
Create a file named as '.htaccess' in root and add the below code. That's it
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
The example here is in the /public directory. You will also need to configure you're server correctly and have it look only at the /public directory instead of root. You shouldn't need an .htaccess file in the root.
You will need a httpd-vhosts.conf with something like the following:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName yourapp.com
ServiceAlias www.yourapp.com
DocumentRoot /var/www/yourapp/public
</VirtualHost>
Notice this line:
DocumentRoot /var/www/yourapp/public
You can read more about Laravel webserver configuration here.
inside of your main .htaccess it should read:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
replace the existing " RewriteRule ^(.*)$ public/$1 [L] " if something like this exist.
below solution worked for me.
Create .htaccess file in root directory and place code something like below. copy server.php file and paste it in root directory with named as index.php .
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