I just tried a url on my live site and saw this:
if ı write my url artisan, for examlple oguzkurukaya.com/artisan
it shows artisan folder or downloads it. How can disable this?
You should set the root path of your website to public folder - which contains index.php file.
Related
Hello am actually trying to setup laravel app on shared hosting. to simulate this i simply trying opening project directly from public folder, instead to doing PHP artisan serve.
but i don't know why am redirecting to root directory
for ex
here is my URL
http://localhost/sar/public/
but when i try to access Add-Subject by using this.
Subjects
am redirected to this URL
http://localhost/Add-subject
but i want URL like this : http://localhost/sar/public/Add-subject
For testing purpose I have Installed fresh Laravel-7 and also installed joedixon/laravel-translation package, all are working fine.
After that I have changed root directory and others (I have to change for implementing the Translation in another running project which root directory like that)-
Change things are-
Moved index.php into root directory, ex: myproject/public/index.php to myproject/index.php
Move .htaccess into root directory
In index.php, changed-
require __ DIR __.'/vendor/autoload.php';
and
$app = require_once __ DIR __.'/bootstrap/app.php';
And for Translation I added the /public/ for the path of css, js in resources/views/vendor/translation/layout.blade.php
And now all are working but when I try to update the translation file, It throws an error showing the requested url is not found.
Everything else seems to work fine expect for updating the translations.
How to solve ?
Screenshot attached.
enter image description here
i didnt work with this package before but i have noticied a double slash // in your requested url you trying to post to ( in the screenshot ) so that could cause a 404 since there is difference between
http://localhost/cartpro_language_test//languages/bn
and
http://localhost/cartpro_language_test/languages/bn
make sure its accesible in your routes check php artisan route:list
by default its accessible under /languages not /cartpro_language_test/languages so verify if there is any other changes you made that cause the url to be different than the one sat up
i did the exact same modifications and its working for me
im new in laravel so im just try to run laravel without php artisan and read much topics about run laravel without php artisan but the main problem is the main route (/) is working and run (home view) but other routes like (/about) in web file doesnt work. so how can i run other views via routes (web file)?? i tried many ways for run laravel without php artisan but im stuck in this part routes. without routes, laravel is completely useless. i moved index.php from public folder and .htaccess to the root folder for run laravel wihout php artisan like this:root folder laravel
and this my index.php so i changed it to run from root not public folder:
index.php file
and .htaccess:
.htacess file
and finally this is my web file which is my routes:
web.php
when i set routes about and try to go to that, the error 404 is shown up: error 404 /about route
so how can i set routes and actualy the main problem is how can i request and Recieve urls from root without php artisan. and another way that i tried is rename server.php to index .php and i could say none of this ways are working. it just show the root home page not working for other routs. thanks
I created Laravel project and able to make it work to get json output as well. However image link in json is not working.
https://android.factory2homes.com/
json: https://android.factory2homes.com/index.php/api/products
image link:https://android.factory2homes.com/index.php/public/12142.jpg
i tried creating symlink and copied same image in storage folder as well, but not able to make it work.
The public folder in a Laravel project is basically the root folder that shows up on the website URL.
For security issues, you really don't want the users to have the ability to write anything directly on the public folder, because if you are not careful they could overwrite your php scripts and have them do whatever they want.
So generaly speaking you create a simlink inside the public folder to the storage folder that is outside the public directory. Laravel has even a built in artisan command to do that exactly which is:
php artisan storage:link
The URL to any image stored in that folder would be in your example:
https://android.factory2homes.com/storage/12142.jpg
You do not have to put any .php file, or public or anything else.
if the image is inside public then I don't think you need to give the url like index.php/public/someimage.jpg you can just do www.yousiteurl.com/someinage.jpg
I resolved issue by savings images to Public_html folder instead of public folder in Laravel app root folder. Public_html is the path that is visible to public, hence other solutions weren't working.
I have set Laravel dropzone and it's working on my project.
I have cloned that project and trying to modify things but when I'm trying to upload files it's working and they are in the storage but when I want to see my files that I have uploaded I get
404
Sorry, the page you are looking for could not be found. error
This is my link when I click on the document
I'm using Laragon
EDIT:
I noticed that I have public >storage>storage
path:
public\storage\storage
And also a file named storage where I have a public file with an app file where inside I have another storage file
something like
path:
storage\app\public\storage\
Your link is looks like incorrect, http://mylocal.test/storage/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf the storage path repeated on the url.
Can you try single storage path in the url?
http://mylocal.test/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf
SOLUTION: when you clone your project delete public>storage and run
php artisan storage:link
to link it with your new path