Next.js Discord

Discord Forum

Sub-Domain Redirect

Answered
Donskoy posted this in #help-forum
Open in Discord
DonskoyOP
I'm trying to add sub domain to my Next.js application to make dynamic domain pages.
For example: sub.domain.com.

I have tried to use Redirect function in the .Config file like this, but it's a bit tricky:

const nextConfig = { async redirects() { return [ { source: "/:path*", destination: "/", permanent: true, }, ]; }, }; module.exports = nextConfig;
Answered by B33fb0n3
ah ok. Let me correct my message: you can add a sub domain on your providers dashboard. You don't need to redirect something
View full answer

7 Replies

you can add a sub domain on the vercel dashboard. You don't need to redirect something @Donskoy
@Donskoy I'm not using Vercel to host this app
ah ok. Let me correct my message: you can add a sub domain on your providers dashboard. You don't need to redirect something
Answer
@B33fb0n3 ah ok. Let me correct my message: you can add a sub domain on your providers dashboard. You don't need to redirect something
DonskoyOP
So that means I don't need to change anything with the code?
@B33fb0n3 yeah 🙂
DonskoyOP
Thank you so much! It worked! :amazing:
Turkish Van
Hello
Uploading build in Sub folder/ Sub Domain
My build gets uploaded in random folder
https://xxxx.cloudfront.net/builds/36ff39dfe3f0fcd7ae7aa4d87b12c168/
36ff39dfe3f0fcd7ae7aa4d87b12c168 random folder will generate dynamically,
How to update the path for all js & css

In react js, if we adding
"homepage": "./"
It is working fine, How to resolve it in next js projects