Nexology Community
 
     
 
   

Go Back   Nexology Community > Support Zone > General Support

Reply
 
LinkBack Thread Tools Display Modes
Old 04-07-2004, 09:34 AM   #1
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
Subdomain redirect scripts

The new Plesk 7 has real subdomain support so we would like to encourage everyone (especially those with multi-domain accounts) to use subdomains even with redirects. Using the old system, you would create a subdomain just like a norrmal domain and if you wanted a redirect, you'd choose the Standard Forward or Frame Forward option under Setup.

You can achieve this with the new subdomain system as well. To create a subdomain as a standard forward, the quickest way to achieve this is with PHP. You can quickly create your subdomain in Plesk and then go into the file manager, go into subdomains, click on your new subdomain and then httpdocs. Create a file called index.php and enter this code (replacing the URL for whatever you will need):
Code:
<?php
header("Location: http://www.domain.com/subdirectory");
exit;
?>
Here is an example:

http://hostnexus.control-access.com/

To get the popular Frame Forward affect, you simply need to make a file called index.html and enter this code:
Code:
<HTML> 
<HEAD> 
<TITLE>TITLE GOES HERE</TITLE>
</HEAD> 

<FRAMESET COLS="100%"> 
  <FRAMESET ROWS="100%"> 
    <FRAME SRC="http://domain.com"> 
  </FRAMESET>
</FRAMESET> 
</HTML>
(Many thanks to RobbieLePommie for that code)

And here is an example:

http://hn.control-access.com/

So if you have subdomains, please try and convert them to this new system as it will have a possible affect on apache restart times.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 04-07-2004, 10:37 AM   #2
HaveANiceDay
 
middleground's Avatar
 
Join Date: Apr 2002
Location: MacTopia
Posts: 4,167
Quick question- if we delete the top domain and create the subdomain as you noted, will there be any delays in it working (dns), or will it be live right away?
__________________
Every Day Above Ground Is A Good One !!

"A word to the wise ain't necessary -- it's the stupid ones that need the advice." -- Bill Cosby

MiddleGround | MGWebDomains.com | MGWebDomains.net

"With the Heart and Mind united in a single Perfect Sphere." (Neil Peart)
middleground is offline   Reply With Quote
Old 04-07-2004, 11:00 AM   #3
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
It will be live before you get a chance to launch a browser (or pretty quick anyway ).
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 04-07-2004, 05:22 PM   #4
van
Registered User
 
van's Avatar
 
Join Date: Mar 2004
Location: Mendoza & B.A.
Posts: 76
I tried
http://hostnexus.control-access.com/ and I only get a blank page:

I do see this code when looking at source code:

<?php
header("Location: http://www.hostnexus.com");
exit;
?>

Looks fine to me. Any Idea why this happens?

hn.control-access.com frame redirect works perfectly though.

Flavius
van is offline   Reply With Quote
Old 04-07-2004, 07:47 PM   #5
HaveANiceDay
 
middleground's Avatar
 
Join Date: Apr 2002
Location: MacTopia
Posts: 4,167
I've been using these in html pages (example http://www.lansberry.net )

PHP Code:
        <meta http-equiv="refresh" content="0;URL=http://www.middleground.us"
and

PHP Code:
    <body onload="window.location.href=http://www.middleground.us"
may not be the quickest, but works across browsers and OS's
__________________
Every Day Above Ground Is A Good One !!

"A word to the wise ain't necessary -- it's the stupid ones that need the advice." -- Bill Cosby

MiddleGround | MGWebDomains.com | MGWebDomains.net

"With the Heart and Mind united in a single Perfect Sphere." (Neil Peart)
middleground is offline   Reply With Quote
Old 04-07-2004, 11:31 PM   #6
Moderator
 
MikeMann's Avatar
 
Join Date: Jun 2002
Location: Los Angeles CA
Posts: 7,528
Using a meta-refresh and setting it to 0 can get you bounced by some search engines.
__________________
Michael Mann

Michael Mann Desktop Publishing
Me On the Net: Facebook | Twitter | Squidoo | Yahoo! Contributor Network

Ubuntu Linux User since 08.04 (April 2008 release)

Virus? Computer slow? In LA? Downtown LA PC Techs can help.
MikeMann is offline   Reply With Quote
Old 04-08-2004, 03:15 AM   #7
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
Hmmm, no idea what happened to http://hostnexus.control-access.com/ as it was working fine before. I must have done something stupid and the answer must be staring me in the face....testing....
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 04-08-2004, 04:18 AM   #8
You and what a
 
RobbieLePommie's Avatar
 
Join Date: Aug 2002
Location: Sydney
Posts: 5,928
Quote:
Originally posted by MikeMann
Using a meta-refresh and setting it to 0 can get you bounced by some search engines.
If you have a redirect in htaccess they generally only index the redirected site. That's my experience with the www.domain.com and domain.com, anyway. It makes sense they would do this for a META refresh as well; after all most META refreshes exist to say "My site has now moved, taking you there now..."
__________________
Rob
----------------------------
For your information, there's a lot more to ogres than people think.
RobbieLePommie is offline   Reply With Quote
Old 04-08-2004, 04:33 AM   #9
HN Top Canine
 
NexDog's Avatar
 
Join Date: Jan 2002
Location: The Nexus
Posts: 13,328
Anyhow, I simply forgot to check off PHP support for the subdomain. This works:

http://hostnexus.control-access.com/

Look how fast it it is. I reckon it's faster than .htacess and definitely alot faster than meta-refresh or JS.
__________________
Laurence - [HostNexus Administrator]

- Need Support? Quickest reponses are found at the Support Helpdesk!
- Stay in touch! Make sure you are subscribed to our Lists.
NexDog is offline   Reply With Quote
Old 12-02-2005, 02:08 PM   #10
Registered User
 
Join Date: Mar 2005
Location: Connecticut
Posts: 92
I wrote an automated version of the first PHP script. This will automatically turn 'sub.example.com/page.php?a=test' into 'example.com/sub/page.php?a=test' Just copy and paste the following code.
PHP Code:
<?php
    $domain 
$_SERVER['SERVER_NAME'];
    
$data $_SERVER['REQUEST_URI'];
    
    if(
fnmatch('*.*.*',$domain)) {
        
$domain explode('.',$domain);
        
$newDomain $domain[1].'.'.$domain[2].'/'.$domain[0].$data;
        
        
header('Location: '.$newDomain);
    } else {
        echo 
'Could not forward from this URL.';
    }
?>
Hope that helps

Note: This does not support TLDs such as '.co.uk', '.com.cn', or any TLDs with two parts.

Last edited by theDan; 12-02-2005 at 02:23 PM.
theDan is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:16 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 RC1
Copyright ©2001 - 2009, HostNexus