More jumping domains

Using a single web hosting account to host multiple sites

More jumping domains

Postby titaniumdecoy » Mon Aug 28, 2006 6:30 pm

I have another question related to this issue.

Most of the time my MediaWiki installation at ext.com works perfectly. For example, if I type ext.com/Cookie, the page loads right away.

However, if I type something after the domain that does not begin with a capital letter, MediaWiki automatically converts it to an uppercase letter, and in the process the page jumps from ext.com/cookie to ext.base.com/Cookie back to ext.com/Cookie. Is there some way to prevent the wiki from loading the ext.base.com address?

I would ordinarily assume that this issue would be a problem with the MediaWiki settings, but I searched all the config files and database tables and couldn't find the term "base.com" anywhere.

It might help to note this also happens occasionally with other wiki functions; for example the "random page" link also makes this jump.

Thanks for any feedback.
titaniumdecoy
 
Posts: 23
Joined: Wed Sep 14, 2005 11:24 am

Postby richardk » Tue Aug 29, 2006 3:49 am

Surely there's a setting in mediaWiki to set your domain name?

Else:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^ext\.com$ [NC]
RewriteRule ^(.*)$ http://ext.com/$1 [R=301,L]

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

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby titaniumdecoy » Tue Aug 29, 2006 5:01 pm

That's almost exactly what I have in my .htaccess file, and the domain still "jumps" back and forth--although it seems only when a page cannot be found at first.
titaniumdecoy
 
Posts: 23
Joined: Wed Sep 14, 2005 11:24 am

Postby richardk » Wed Aug 30, 2006 4:41 am

Well mod_rewrite can't stop it showing the subdomain, all it can do is redirect back to the domain. The only way to stop it redirecting ios to find a setting in MediaWiki or edit it's code and hardcode you domain. You could try this at the top of index.php:
Code: Select all
$_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = 'ext.com';
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby titaniumdecoy » Wed Aug 30, 2006 4:45 pm

Dang, that actually worked. I put that at the top of the LocalSettings.php file.

Is there a way to detect whether the domain starts as www.ext.com or ext.com and redirect appropriately? (eg, www.ext.com/moo goes to www.ext.com/Moo, while ext.com/moo goes to ext.com/Moo.) I'll try and figure this out myself and get back to you.

EDIT: Here is my solution. It may not be elegant, but it works:
Code: Select all
if ( strpos($_SERVER['HTTP_HOST'], 'www') === 0 )
   $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = 'www.cppdocs.com';
else
   $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = 'cppdocs.com';
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 69 guests

cron