Permanent HTTP 301 Redirect

Sponge is using a temporary (HTTP 302) redirect from http://www.spongepowered.org to http://spongepowered.org. It’s fine, but a permanent (HTTP 301) redirect is considered best practice.

After doing some testing, I found that 60% of pages on other websites link to http://www.spongepowered.org, which can potentially splitting up your search engine ranking.

4 Likes

@lukegb

2 Likes

Sure, it’s best practice. I’m not fully sure if, for instance, the Google crawler makes any distinction between 302 and 301: https://developers.google.com/webmasters/ajax-crawling/docs/faq?csw=1#redirects

301 is considered best practice for this point, exactly. For instance, my router.conf for nginx.

server {
    listen 80;
    server_name www.ferusgrim.me ferusgrim.me;
    server_tokens off;
    return 301 https://www.ferusgrim.me;
}

server {
    listen 443 ssl;
    server_name ferusgrim.me;
    server_tokens off;
    include /etc/nginx/conf.d/ssl/ssl.conf;
    return 301 https://www.ferusgrim.me;
}

server {
    listen 80;
    server_name blog.ferusgrim.me;
    server_tokens off;
    return 301 https://www.ferusgrim.me;
}

server {
    listen 443 ssl;
    server_name blog.ferusgrim.me;
    server_tokens off;
    include /etc/nginx/conf.d/ssl/ssl.conf;
    return 301 https://www.ferusgrim.me;
}

server {
    listen 443 ssl;
    server_name url.ferusgrim.me;
    server_tokens off;
    return 301 http://url.ferusgrim.me;
}

server {
    listen 80;
    server_name repo.ferusgrim.me;
    server_tokens off;
    return 301 https://repo.ferusgrim.me;
}

server {
    listen 80;
    server_name ci.ferusgrim.me;
    server_tokens off;
    return 301 https://ci.ferusgrim.me;
}

server {
    listen 80;
    server_name mail.ferusgrim.me;
    server_tokens off;
    return 301 https://mail.ferusgrim.me;
}

server {
    listen 80;
    server_name znc.ferusgrim.me;
    server_tokens off;
    return 301 https://znc.ferusgrim.me;
}

server {
    listen 80;
    server_name git.ferusgrim.me;
    server_tokens off;
    return 301 https://git.ferusgrim.me;
}

server {
    listen 80;
    server_name dev.ferusgrim.me;
    server_tokens off;
    return 301 https://git.ferusgrim.me;
}

server {
    listen 443;
    server_name dev.ferusgrim.me;
    server_tokens off;
    return 301 https://git.ferusgrim.me;
}

Moved to “Sponge Web” since this is not discussion about the forum itself but the website.

1 Like

Wait, you can have 2 server names in a server block, Cools, I never knew you can put shared configuration in another file, I’ll note that for later use.

1 Like

Sorry I haven’t done anything about this yet.

We don’t actually redirect from http://www.spongepowered.org to http://spongepowered.org - if you attempt to connect to the HTTP version of the site, you will be redirected to the HTTPS version (using, at the moment, 302 Found). At present, both https://spongepowered.org and https://www.spongepowered.org will work, and both return the same content (i.e. there is presently no canonical version of the site).

My plan is to make https://www.spongepowered.org the canonical version and make the http and non-www variants redirect using an HTTP 301, as suggested by the OP, to that version,

2 Likes