"Jumping" URLS

Using a single web hosting account to host multiple sites

"Jumping" URLS

Postby titaniumdecoy » Sun Aug 27, 2006 1:12 pm

Hi,

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.
titaniumdecoy
 
Posts: 23
Joined: Wed Sep 14, 2005 11:24 am

Postby richardk » Sun Aug 27, 2006 2:12 pm

You don't want the redirection from / to /Main_Page, right?
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [QSA,L]


If it still redirects, it'll be MediaWiki not mod_rewrite (because the RewriteRule doesn't match / or nothing). But you could probably stop it with this:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^$ /index.php?title=Main_Page [QSA,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [QSA,L]

Or if that doesn't work, try replacing "/index.php?title=Main_Page" with "/Main_Page".
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby titaniumdecoy » Sun Aug 27, 2006 2:49 pm

Oh, wow... thank you so much. I must have spent hours on this.
Code: Select all
RewriteRule ^$ index.php?title=Main_Page [QSA,L]

That did it. Thanks again.
titaniumdecoy
 
Posts: 23
Joined: Wed Sep 14, 2005 11:24 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 29 guests

cron