* Return the request URI with the canonical service and hostname, path,
* and query string. This will be suitable for use as an absolute link
* in HTML or other output.
- *
- * NOTE: This will output a protocol-relative URL if $wgServer is protocol-relative
+ *
+ * If $wgServer is protocol-relative, this will return a fully
+ * qualified URL with the protocol that was used for this request.
*
* @return String
*/
public function getFullRequestURL() {
- global $wgServer;
- return $wgServer . $this->getRequestURL();
+ return wfExpandUrl( $this->getRequestURL(), PROTO_CURRENT );
}
/**
$title = SpecialPage::getTitleFor( $name, $subpage );
}
}
- $targetUrl = $title->getFullURL();
+ $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
// Redirect to canonical url, make it a 301 to allow caching
if ( $targetUrl == $request->getFullRequestURL() ) {
$message = "Redirect loop detected!\n\n" .