I have a domain name, say base.com, which corresponds to /home/username/public_html/. I recently purchased another domain, say ext.com, which corresponds to ext.base.com (/home/username/public_html/ext/).
I have an installation of MediaWiki installed at /home/username/public_html/ext/. So URLs by default map to ext.com/index.php?title=Main_Page. I want the URLs to map to ext.com/Main_Page.
The following code correctly rewrites requests to ext.com/Main_Page internally to ext.main.com/index.php?title=Main_Page:
- Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?title=$1 [L,QSA]
However, this also causes the URL to be rewritten from ext.com/ (the domain followed by / or nothing) to ext.main.com/Main_Page. I don't know if this is because of MediaWiki or the RewriteRule. That is where I need help.
I have tried the following, and it works, although the domain "jumps" from ext.com to ext.main.com/Main_Page back to ext.com/Main_Page:
- Code: Select all
RewriteCond %{HTTP_HOST} !ext\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*)$ http://ext.com/$1 [R=permanent,L]
Any ideas? Thanks.