Next.js Discord

Discord Forum

Is there a way to change the url image is served at?

Answered
Blanc de Hotot posted this in #help-forum
Open in Discord
Avatar
Blanc de HototOP
Right now the url of the image is http://localhost:3000/_next/static/media/<img_file_name>.<token>.<extension>

is there a way i can serve images at a static route link http://localhost:3000/<img_file_name>.<extension>
Answered by Yi Lon Ma
move the public folder outside src
View full answer

10 Replies

Avatar
if you are using next/image then no because next image performs certain optimization, if you the results you expect, put the images in public folder and access them at /
Avatar
Blanc de HototOP
this code just gives not found error for the path... in this case http://localhost:3000/assignment.png
Image
Image
Avatar
remove .next folder and restart
Avatar
Blanc de HototOP
same thing still
Image
should there be something different in my .next folder?
Avatar
.next folder is made by nextjs itself
I've never even looked into it
Avatar
move the public folder outside src
Answer
Avatar
in your project's root
Avatar
Blanc de HototOP
thank you so much for your help that was the problem