Topic on Project:Support desk

Jump to navigation Jump to search
Scott216 (talkcontribs)

I'm running MW 1.32, PHP 7.0.33, MySQL 5.6.40 with Vector skin. When is use the built in search, most of the time it works fine. For example, if I search on "Restaurant", I'll get search results and the URL looks like this:

http://wiki.mydomain.com/index.php?search=restaurant&title=Special%3ASearch&go=Go


But if I put in a search term where there exists a wiki page with the same name, I get a 404 error. For example, if I search on Automobile, I get a 404 error and the URL looks like this:

http://wiki.mydomain.com/http://wiki.mydomain.com/index.php?title=Automobile


I have a wiki page called Automobile:

http://wiki.mydomain.com/index.php?title=Automobile


For some reason, when my search term matches an existing page, my domain name is listed twice in the URL field.


TheDJ (talkcontribs)

One of the variables in your LocalSettings config is not correct and using a full url instead of a url path component.

Scott216 (talkcontribs)

Any idea which variable? I looked through my LocalSettings file and can't figure out what might be the cause. I recently upgraded to 1.32 from 1.24.

Scott216 (talkcontribs)
Jonathan3 (talkcontribs)
Ciencia Al Poder (talkcontribs)

I think you need to set $wgScriptPath = "/"; not blank

Scott216 (talkcontribs)

Fixed problem by adding

$wgServer = "./";

to LocalSetting.php


I also tried $wgScriptPath = "/"; but that broke everything.

BTW - My wiki is installed in /home/goldthwa/public_html/

and my URLs look like this:

http://wiki.mydomain.com/index.php?title=Automobile

This is how it was setup by Siteground (my hosting provider) back in 2007

Ciencia Al Poder (talkcontribs)

Setting $wgServer = "./"; is a really bad idea. Good for you if it works on your configuration, but this is something that should break the wiki in unexpected ways.

Jonathan3 (talkcontribs)

Manual:$wgServer under the heading "Universal value" states: "In situations where a server URL is subject to change (i.e. frequent MediaWiki installation porting, intranet access, etc.), setting $wgServer to ./ will work without causing CSS not to work."

Ciencia Al Poder (talkcontribs)

That was added by an anon less than 2 years ago. I highly doubt this has been tested thoroughly, specially if you have Pretty URLs like on WMF wikis. It could only work inside browsers where URLs can be made relative, but it won't work in situations where one expect an absolute URL, like on sitemaps, api responses, etc.

Ciencia Al Poder (talkcontribs)

I've removed the "Universal value" section of that page. I've tested it on a wiki with Short URLs (/wiki/Pagename and /w/index.php), and after saving the page you get redirected to literally "wiki/Pagename" without server name nor protocol.

Jonathan3 (talkcontribs)

Thank you for clarifying that and for fixing the page.

Reply to "Search result give 404 error"