I have three domains all pointing to the same hosting space, mirrored using A
records:
example.org
example.org.uk
example.co.uk
I have a website on the root (/
), and a MediaWiki installation at example.org/members/wiki
. I'd like all requests to redirect to HTTPS and to the .org
domain.
I've managed this with the website using .htaccess
in the root:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !example.org$ [NC]
RewriteRule (.*) https://www.example.org/$1 [R=301,L]
but I can't get it to work with the wiki -- requests to the .org.uk
or .co.uk
domains are not redirected.
I have this .htaccess
in /members
:
Options -Indexes
RewriteEngine On
RewriteRule ^example.org.uk(/.*)?$ https://www.example.org/$1
RewriteRule ^example.co.uk(/.*)?$ https://www.example.org/$1
# MediaWiki pretty URL rewrites
RewriteRule ^/?members/wiki(/.*)?$ %{DOCUMENT_ROOT}/members/wiki/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/members/wiki/index.php [L]
I want, for example, example.co.uk/members/wiki/My_Page
to seamlessly redirect to https://www.example.org/members/wiki/My_Page
.
Can anyone tell me what's wrong?