config sentinel to work with "public/index.php" in laravel - laravel

I have install Laravel in my VPS, and it's working with the "public/index.php" in the url. I had tried lot more to remove this from url but all are failed, and I have to work with this. Currently I am working on the Sentinel authorization package. It's installed successfully but after login or when i click on the sentinal logo I always get redirected to the "http://myipaddress/tmb/" which is incorrect, so where I can set the home link so that it goes to the "http://myipaddress/tmb/public/index.php/". My laravel version is 5.1.20

The default config for the target URLs is the 'home' route. So you have to setup this route in your routes.php properly.
You can override the default routes in the config/sentinel.php file.
But anyway, it's very dangerous that anyone can access your whole application code directory. You should either forbid access to all resources which are not in /public directory or (much better) configure/ask your VPS to set the document root to your public directory!

Related

redirect API requests to a different subfolder

I need help in creating a redirect.
Our Current Setup:
We have a mobile app that accesses the API via https://ourwebsite.com/oldapi/mobiledata
We have moved to a new webserver and need the API path to stay the same.
On the new server, Wordpress lives at /var/www/html/webserver.com/public which resolves to https://ourwebsite.com and the Apache2 Document root
points to /var/www/html/webserver.com/public
Laravel has been installed on the webserver at: /var/www/html/webserver.com/laravel/ which is one folder below the Document root
A symbolic link has been created in /var/www/webserver.com/public/hq/ to point to /var/www/html/webserver.com/laravel/ so the Laravel App can be accessed by visiting: https://ourwebsite.com/hq/
Note: Another Symbolic link has been created for the laravel storage at /var/www/webserver.com/public/hq/storage which points to /var/www/html/webserver.com/laravel/storage/app/public
The new Laravel API endpoints are accessed at https://ourwebsite.com/hq/api/v1/
The Question
We need to preserve one particular endpoint1, and have its route be: https://ourwebsite.com/oldapi/mobiledata
Here is where I am confused. Since Laravel lives in https://ourwebsite.com/hq/ and Wordpress lives at https://ourwebsite.com, how can we set up the .htaccess so that the laravel route in /var/www/dux.city/laravel/config/api.php
I am guessing I need some fanciful .htaccess in the Wordpress route at /var/www/html/webserver.com/public

Laravel SPA (laravel + vuejs + sanctum) deployed in subdomain returns wrong api

I have this problem since several days.
I'm developing a Vuejs/laravel app, using Sanctum as an authenticator. where laravel mainly have the api gestion role, and I've started to deploying it. On Local, everything looks fine, api and auth are working.
On deploy, since my app is binded to be in a subdomain (laravelapp.maindomain with folder path of domain/laravelapp), when i try to access any page (vue-router) instead of domain/laravelapp/login i get domain/login, even if the page itself is looking fine.
If i try to reload the redirected page (domain/page) i have a 404. Also, since every API is pointing to domain/api/link instead of domain/laravelapp/api/link, everything is broken starting with auth.
I've tried modifying .env file, RouteServiceProvider, .htaccess(but i have no knowledge about that).
I also tried to set the subdomain Document Root to domain/laravelapp (it's the first thing i've done), but not only it dosn't work, if I try to print on screen subdomain's root, it returns domain. It's becoming a real issue right now, thank you for any help.
EDIT: I've discovered something. in the main domain there is a Joomla application. The api route contains the Joomla redirect (like, there is a plugin oh the site that changes language automatically, appending /en /it /de given the chosen language). So, in my case, the api is domain/index.php/en/subdomain. I tried again being more specific with document root, with no results, and playing around with .htaccess, but with no success.

Configuring Laravel project in DirectAdmin server

I'm a newbie to Laravel projects but I need to have one accessible over the internet so I tried using DirectAdmin but whenever I go to my domain I get an index (pictures attached).
I renamed the Laravel 'public' folder to 'public_html', is that correct? Here is my file structure.
Here is what I get when I go to my assigned domain which isn't my website at all.
The webpage should look something like this
I also found a laravel app using Softaculous linked here (https://panel.freehosting.com:2222/CMD_PLUGINS/softaculous/index.raw?act=software&soft=419). Am I required to use this app?
At first, you need to learn about the laravel directory structure. You don't need to change the laravel public folder to public_html. I am not sure how the DirectAdmin server works. but if you see a laravel directory instead of serving an application it's might be a path-related issue in your server. your domain should serve your application public folder.
I just found a tutorial for the DirectAdmin server with laravel. that might help.

Laravel on a directory, links e.g. login link does not work

I have uploaded my Laravel app unto a directory under the public folder on my domain,
html_docs/public/store
where 'store' is the folder of my Laravel App. My main domain pointed at 'html_docs/public', please check my laravel app here "https://www.dinhi.org/store/". As you can see, when you click the "sell with us" or "login" on the top header, it returns
Not Found
The requested URL /store/dashboard/login was not found on this server.
I have set up to in my '.env' and in my 'config/app.php' the right url like "https://www.dinhi.org/store/" but still not working, any ideas, help please?
PS: I'm on Laravel 5.3 and I'm using Hesto Multi Auth. In my local, this issue does not exist like everything is good and working.
Laravel is not meant to be installed completely into the document root of your server. Actually, every folder of your laravel application except the public folder should be inaccessible from the web.
Your exposing yourself to a security risk here, since everybody could access every file of your app, including potential .env files with database credentials and the likes.
Cheers
Christoph

Routing problems with Laravel 5 on BlueHost Shared Server

I am in the Beta stage of a Laravel 5.0 project using BlueHost as the server. I have not finalised the domain so I am using a temporary address as follows:
IP Address/username
In a normal Laravel project the root URL is the domain name of the website and routing starts from there. However, in this environment, I have to adjust the route.php file. For instance, instead of the familiar
Route::get('/', 'WelcomeController#index');
I've had to do this:
Route::get('/username/', 'WelcomeController#index');
With the usual adjustment in the .htaccess to re-route everything to the public Laravel folder, I can use the temporary address and access the welcome page. However, when I start adding security with the Auth controller, the re-directs don't work. When accessing a secure URL, you are re-directed to IP Address/auth/login instead of IP Address/username/auth/login. In the .htaccess file in the public folder I've added:
RewriteBase /username/
with both slashes, but that doesn't help. Does anyone know how to set up a Laravel project with a secure area, secured by the Auth controller which has a URL that includes a second segment?

Resources