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!'; });
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>
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
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.
@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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community