Sunucunuzun config ayarlarını hangisini kullanıyorsanız aşağıdaki şekilde güncelleyin. Bu şekilde sayfalarınız doğru şekilde yönlendirilecek.
Express
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'path/to/your/index.html'), function(err) {
if (err) {
res.status(500).send(err)
}
})
})
Appache (.htaccess)
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
Nginx (.conf)
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
IIS (web.config)
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule1" stopProcessing="true">
<match url="^index\.html$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>