I have a subdomain http://206.217.128.227/~obts/ . I hosted my laravel project on this subdomain . This domain's cpanel structer is
When I click on any href property the url is http://206.217.128.227/something but then i have 404 error . But if I give url manually http://206.217.128.227/~obts/something then i get the correct page. I have pasted public folder's content on public_html folder. And all other contents of project on laravel folder. I modified index.php file as
require __DIR__.'/../laravel/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';
I added paths.php file manually and modified 'public' property as
'public' => __DIR__.'/../public_html',
My .env file is
APP_ENV=local
APP_DEBUG=true
APP_KEY=something
APP_URL=http://206.217.128.227/
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=obts_data
DB_USERNAME=obts_admin
DB_PASSWORD=password
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Now what wrong i am doing ?
The question has already been answered by me in the comments. This little article will summarize what was asked and what was wrong.
Question: OP reported that he set up a new L5.2 project where his "views" folder is outside his L5.2 project structure (as shown in the image below). He modified the index.php
file to include this new view path
. However his URLs of type http://206.217.128.227/something
were not working whereas URLs of type http://206.217.128.227/~obts/something
were working fine.
Answer: The issue here is that his generated URLs does not contain ~obts
in the path and thus L5.2 was reporting errors. Pretty easy fix.
However, I would like to suggest a few things here:
public_html
folder by editing the index.php
file is not recommended. What will happen when you update L5.2. Chances are these files will be overwritten. The right way is to edit the larave/config/view.php
file and change the paths
array.~obts
contains the unsafe character ~
. See this article for what characters are safe.