Rule from network under performance category
Passmarked is made out of users just like you who helped supply some content. Click below to contribute to this rule. We need you.
Redirects are quite useful but developers/site owners must keep in mind that every redirects adds latency.
Although the latency can be saved using caching, the problem with client-side redirects are that they cannot be cached.
Remove the logic that redirects on the client-side scripts, and rather use the logic server-side as part of the application code or server config. With server-config being the best case here to save more processing time.
Apache can be setup as such:
<VirtualHost *:80>
ServerName www.domain1.com
Redirect / http://www.domain2.com
</VirtualHost>
While NGINX can also be configured using:
server {
listen 80;
server_name domain1.com;
return 301 $scheme://domain2.com$request_uri;
}
Both of these examples redirect using 302 (temporary), using 301 (permanent) will allow browsers to fully cache and hit the server again. Usage depends on your scenario.
Passmarked works best when you have an account. It allows you to keep a dashboard with saved data of the sites you have run through the system, we’ll alert you about important updates and you get access to the Passmarked Slack forum.
Sign up to get started