Jump to content

Topic on Project:Support desk/Flow

"redlink=1" -> 302 Moved Temporarily. Change response code to 200?

8
Summary by MarkAHershberger
2A02:AA16:9100:8300:242C:64BC:84C1:D41A (talkcontribs)

Hi,

I've an old Mediawiki Version:

MediaWiki: 1.15.1

PHP: 5.4.45 (cgi-fcgi)

MySQL: 5.5.40-log

Problem/Case:

If article does not exist yet = Red hyperlink it behaves in my version like:

http://xy.com/wiki/index.php?title=AAA&action=edit&redlink=1 - 302 Moved Temporarily

goes to (redirect)

http://xy.com/wiki/AAA - 404 Not Found

Now I see that Wikipedia makes "redlink=1" URL to a HTTP status code 200.

(like https://de.wikipedia.org/w/index.php?title=Procure-to-Pay&action=edit&redlink=1)

How can I change that also in my Mediawiki like Wikipedia?

Was this a mistake/bug (to generate 302 instead of 200) from the version 1.15.1?

(Google Webmasterools discovered this errors too)

Best regards

Mark

88.130.77.167 (talkcontribs)

Before you start thinking about error codes, for the security of your own data, you should better upgrade.

Error code 200 means: The expected content is present at this location. If in contrast, like for a red link, there in fact is no content at the according location, then ending up with an error 404 is correct. Getting a status code of 200 would be wrong. If Wikipedia in fact serves error pages with a 200 status code, then this should be fixed.

2A02:AA16:9100:8300:242C:64BC:84C1:D41A (talkcontribs)

Yes, upgrade should be the best way, but for the moment I would fix this issue with the HTTP status codes.

Ciencia Al Poder (talkcontribs)

There's no error in wikipedia:

https://de.wikipedia.org/w/index.php?title=Procure-to-Pay&action=edit&redlink=1 is not a 404 because you're going to the editing form of the page, which does exist. A different thing is to access the page without action=edit.

The particular &redlink=1 URL parameter is a workaround in case cache fails. For example, you create a page, and an existing link to it doesn't get updated, if you follow a redlink but the article already exists, it will redirect you to the page without presenting the edit window.

There must be some error in your wiki that makes MediaWiki think that page exists, and it's redirecting you to the article, but in the end it doesn't exist.

31.10.154.128 (talkcontribs)

@Ciencia Al Poder

thanks for the explanation!

I think I found the "error". My Wiki is not a everyone write/create Wiki . So I have in mye LocalSettings.php:

$wgGroupPermissions['*']['edit']             = false;

$wgGroupPermissions['*']['createpage']       = false;

In fact, in this situation a normal user by following a red link come's not to a editing form of the page, because he has no rights to write.

If I chage both to =true; it works like Wikipedia.

But whats better for a Website or SEO in my case that only the Admin have rights tho write; to have redlinks with 302 or 200 (If I found a way to make it 200 only for Admins too)?

Thanks

Mark

Ciencia Al Poder (talkcontribs)

Well, that makes sense. In MediaWiki 1.25 the behavior hasn't changed, so I've created task T119292

31.10.154.128 (talkcontribs)

@Ciencia Al Poder

I've found a way to redirect the redlinks article page from the old one 302 to the new 200 HTTP status code, although the permission is for all is false.

Shoud I do that?

Ciencia Al Poder (talkcontribs)