Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: front-end not working when Laravel is installed in a subdirectory #281

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
9 participants
@Zerquix18
Copy link
Contributor

commented Oct 31, 2018

After my pull request #272 I found out that the routes in vue-route were also pointing at /telescope (in the root directory), so anytime I clicked on something, it just showed me a 404 error. I fixed this again after hours of experimenting, and after testing, it works when:

  • Laravel is installed in the DOCUMENT_ROOT directory
  • Laravel is installed in a subdirectory
  • Laravel is called from a subdomain

I can finally use it in peace.

image
image

Hope this is useful.

@taylorotwell

This comment has been minimized.

Copy link
Member

commented Oct 31, 2018

Don't run Laravel in a sub-directory.

@Zerquix18

This comment has been minimized.

Copy link
Contributor Author

commented Oct 31, 2018

I hope you reconsider this if more people in the future come with this problem.

@amitm13

This comment has been minimized.

Copy link

commented Nov 21, 2018

@taylorotwell @themsaid But most peoples use laravel in sub directorty until they release it in product environment. i hope it will fix in next update.

@joshuand1990

This comment has been minimized.

Copy link

commented Nov 27, 2018

@amitm13 maybe use a view composer since its using a variable.

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });

@grey-dev-0

This comment has been minimized.

Copy link

commented Dec 19, 2018

@joshuand1990 That did the trick, thank you.

@itsmekps

This comment has been minimized.

Copy link

commented Jan 6, 2019

@joshuand1990 @grey-dev-0 can you please tell me in little detail, i am new to laravel.

@grey-dev-0

This comment has been minimized.

Copy link

commented Jan 8, 2019

@itsmekps In your AppServiceProvider class add the lines in @joshuand1990 's comment to the boot method.

@dillingham

This comment has been minimized.

Copy link

commented Feb 13, 2019

“Most people” use sub domains not sub directories for staging

@grey-dev-0

This comment has been minimized.

Copy link

commented Feb 20, 2019

@dillingham using subdomains is the right way but, it's not doable for everyone, as for some people they might not be able to access their domain settings to create a subdomain so, they do their testing in a subdirectory instead.

@dillingham

This comment has been minimized.

Copy link

commented Feb 20, 2019

@grey-dev-0 well it not working in sub directories is a good reason to tell your upper management :) if they setup a domain for your production they can setup a simple sub domain so you can do it, as you put it, “the right way” :)

@luisg595

This comment has been minimized.

Copy link

commented Mar 13, 2019

I have the same problem. I need to see telescope from a subfolder. The rules of Nginx works well for Laravel, but telescope isn't works.

@luisg595

This comment has been minimized.

Copy link

commented Mar 13, 2019

@amitm13 maybe use a view composer since its using a variable.

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });

This worked for me. Thank you!

@alessandrobelli

This comment has been minimized.

Copy link

commented May 2, 2019

View::composer(['telescope::layout'], function ($view) { $view->with('telescopeScriptVariables', [ 'path' => 'subfolder/admin/telescope', 'timezone' => config('app.timezone'), 'recording' => ! cache('telescope:pause-recording'), ]); });
Worked like a charm!

@drekinov drekinov referenced this pull request May 29, 2019

Closed

App url Mismatch #624

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.