Mediawiki Fix Internal Server Host Names / Redirection In shared Hosting or Proxy Setup
If you have a MediaWiki installation in a shared hosting environment or behind a proxy, you may encounter issues with internal server host names and redirection. Here are some steps you can take to resolve these issues:
- Modify the
$wgServersetting in yourLocalSettings.phpfile:
$wgServer = "http://your.server.name";This should be set to the fully qualified domain name (FQDN) or IP address of the server that MediaWiki is running on.
- Modify the
$wgUsePathInfosetting in yourLocalSettings.phpfile:
$wgUsePathInfo = true;This will enable the use of clean URLs in MediaWiki, which can help resolve issues with internal host names and redirection.
- Modify your server's Apache or Nginx configuration to handle internal host name and redirection issues:
RewriteRule directive to handle internal host name and redirection issues:RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.your\.server\.name$ [NC]
RewriteRule ^(.*)$ http://www.your.server.name/$1For Nginx, you can use the server_name and
retu directives:server {
listen 80;
server_name your.server.name;
return 301 $scheme://www.your.server.name$request_uri;
}These configurations will redirect all requests to the correct host name, which should resolve any internal host name and redirection issues.
Note: these configurations are just examples, and you may need to modify them based on your specific server setup and requirements.
