'Next.js 404 error after refreshing the page
I try to learn Next.js but I have a small problem. Here is my test code:
import Link from 'next/link';
export default () => (
<p>Hallo next <Link href="/abouts?id=2" as='/abouts/1'><a>About</a></Link></p>
)
If I clicked in link About from index.js page, my url look '/about/1/' and work fine, but if I refresh page I get error 404. If I type in browser /abouts?id=2" and refresh page everything works fine. Do u know how I can fix this ?
I want have links like
/about/1/
Solution 1:[1]
Puedes usar un archivo .htaccess, por ejemplo para un dominio xyz.com donde se creo un portal con nextjs puedes usar este archivo:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteRule ^ /index.html [L]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | José Izquierdo Chávez |
