Reputation: 439
this is my route to access index.php ....http://localhost/abc/public/ if i write http://localhost/abc/ it does pick public bydefault
i want to write .htaccess file to direct http://localhost/abc call to http://localhost/abc/public/ so my url will not hurt..
in short i want http://localhost/abc/ and by dont even change directory struture of laravel.
Upvotes: 3
Views: 1062
Reputation: 101
This worked for me.
Create a .htaccess
in the root folder and place:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Upvotes: 1
Reputation: 439
I have figured it out myself, it was so damn easy. just change server.php file to index.php and change the file paths to public folder and u will be all set to go.
Upvotes: 0
Reputation:
To remove public from url you can try this..
Important: Add following code in your .htaccess (if not exist create a .htaccess on laravel root directory)
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
You can see this link for more help..
Hope this will work.
Upvotes: 1
Reputation: 4302
Put the following code at root .htaccess
file:
RewriteCond %{HTTP_HOST} ^localhost$
RewriteCond %{REQUEST_URI} !^/abc/puplic/
RewriteRule ^abc/(.*)$ /abc/public/$1 [L,NE]
Now , when you request http://localhost/abc/
it will map request to http://localhost/abc/public
but the url will not change
Upvotes: 0