Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

Hello,

In order for you laravel install to work you should point your browser to http://domain.com/~username/public

Your route should be like this: Route::get('/', function() { return 'Hello World!'; });

Last updated 2 years ago.
0

OK thank you, that's made it not break! I can use the site but if possible I'd like to get rid of /public in the URL, is this possible?

My current .htaccess file in root (/~username)

<IfModule mod_rewrite.c>

	RewriteEngine on
	RewriteBase /~username/

	RewriteCond %{THE_REQUEST} ^GET\ /public/ [NC]
	RewriteRule ^public/(.*)$ $1 [L,R=301,NE]

	RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

</IfModule>

and the .htaccess file in /public

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On    
    RewriteBase /~username/

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]
</IfModule>
Last updated 2 years ago.
0

I don't have very strong knowledge on apache configuration.

This is a config I have on one of my servers, adapted for your needs.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^http://domain.com/~username$ [NC,OR]
RewriteCond %{HTTP_HOST} ^http://domain.com/~username$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /publicr/$1 [L]

Hope this helps

Last updated 2 years ago.
0

I have successfully added a laravel subdirectory to a hosted server of a friend. He had a wordpress site.
To get rid of the public part in the url, follow this instructions.
After I could access the laravel page on my local machine without the public part in the name, I just put in into a subfolder on the server. It works without any problems.

Last updated 2 years ago.
0

@Fitzberg , I wouldn't change the default settings in order to remove the public files. If you do that, you would also need to write htaccess files. In an app, you wouldn't want my .env files or artisan to be accessible from the internet.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.