02 Mayıs 2024 07:37

Anasayfa

undefined...

React, NextJS vs gibi tek sayfa (SinglePage Application) web sitelerinde sayfa url i manuel çağrıldığında veya sayfa yenilendiğinde otomatik anasayfaya gitmesini NGINX ile çözümü için aşağıdaki kodu eklemeniz yeterli.

 

NGINX

location / {
    index index.html;
    try_files $uri $uri/ /index.html?$args;
}
 

systemctl restart nginx
 

 

Apache

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
 

systemctl restart apache2
 

Veya

systemctl restart httpd
 

NOT: Test edilmedi ama çalışmalı

Makdos Bilişim Teknolojileri 2015 - 2022