PDA

View Full Version : SubDomain Modification FOR NBSDESIGNZ Script


ForumZCLub
08-12-2006, 12:37 PM
About the script
Subdomains is a PHP script that adds numerous sub domains to your website. When the script has been installed, all you need to do to create a new sub domain is a make a new directory. I.e., if you create the directory http://yoursite.com/newdir then the following sub domain will automatically be added: http://newdir.yoursite.com.

Features
No need to edit any files when you want a new sub domain -- whenever you create a new directory it will automatically function as a sub domain.
Works even if the visitor enters "www." in front of the URL: http://www.dir.yoursite.com and http://dir.yoursite.com will both redirect the visitor to http://yoursite.com/dir.
Case insensitive: http://Dir.YourSite.com, http://DIR.YOURSITE.COM, and http://dir.yoursite.com will all redirect the visitor to http://yoursite.com/dir.
Can be used with or without frames. If you use frames, the location bar in the browser will not change -- i.e., if the visitor enters http://dir.yoursite.com, the location bar will still show this URL when the visitor has been redirected to the new location (http://yoursite.com/dir). If you decide not to use frames, the location bar will change from http://dir.yoursite.com to http://yoursite.com/dir.

Requirements
Before you get too excited, you should know that only a minority of all web hosts meet the requirements of this script. To use Subdomains, you need a web site account with the following features:
Your own domain, i.e. yoursite.com.
Wildcarded DNS. The script will not function without this feature. To check if your web host offers wildcarded DNS, you can perform the following test: Start your browser, pick a random word (i.e. "asdf"), and enter your domain name with the random word in front of it like this: asdf.yoursite.com. If you can see the front page of your web site in your browser now, your web host offers wildcarded DNS. However, if the browser response is something like "unable to locate the server asdf.yoursite.com", then your web host does not offer wildcarded DNS, and you cannot use Subdomains (unless, of course, you move to a server that offers this feature).
PHP (version 3 or later). Ask your web hosting company if you don't know if they offer PHP.
.htaccess. In some cases it is necessary to edit the .htaccess file in order to make the script work. This means that your web host must provide you with the ability to use .htaccess files. If the name of the web server software is Apache, then it is very likely that you can use .htaccess files -- but ask your web hosting company if you are unsure.

Installing the script
First you need to change the file name of your front page. The front page is the file that visitors to your web site see when they enter http://yoursite.com. The current name of this file is probably "index.html", "index.php", "default.html", or "home.html"
Load the script (index.php) into a plain text editor such as KEdit (Linux) or Notepad (Windows). Edit the variables at the top of the page.
The $domain variable should be set to the name of your domain. Do not include "www.". Do not include any slashes ("/"). Just write the domain name, i.e. "yourdomain.com". The $default_page variable should be set to the file name of the front page of your web site. I.e., if your front page is located at http://yourdomain.com/welcome.html, you should write "welcome.html" here. The $use_frames variable: If you want to use frames, write "yes" -- otherwise write "no". Have a look at the features section of this README file and the FAQ if you don't understand the difference between redirection using frames and redirection without using frames.
Use a FTP program to upload the index.php file to your web site account. The file should be placed in the document root (this means that you should be able to call the file by pointing your browser to http://yoursite.com/index.php). You don't need to chmod the script since it is not a CGI script.
Now you can try it out. If it works, you're done. If it doesn't work, check the FAQ.
When you want to create a new sub domain, just make a directory in your document root (i.e. http://yoursite.com/newdir). This will automatically work as a sub domain (http://newdir.yoursite.com). Remember that the name of the directory cannot include CAPITAL LETTERS. If you create a directory named "Newdir", the sub domain thing won't work. If you create a directory called "newdir", it will work.

ForumZCLub
08-12-2006, 12:42 PM
This is not a 100% Solution to Subdomains but is still a useful thing..
Make a Backup of your front page file before using this script .

if you need complete subdomain functionality then either search(create) yourself or Derek Might Add it up later..

Hey What'bout my Repu?

PM Me For Support..

Derek
08-12-2006, 12:44 PM
Moved to a better forum.

ForumZCLub
08-12-2006, 12:54 PM
Also the index file to be used should be of the ROOT Directory that has to be edited !

I and NBSDESIGNZ Wont be responsible For any of your Damages

luky
09-20-2006, 05:47 AM
Aww. My host doesnt have that wildcard DNS. How can they install it?

Derek
09-20-2006, 07:02 AM
Are they running cPanel? If so, here is an excellent tutorial I found on cPanel's forums... http://forums.linuxwebadmin.info/index.php/topic,45.0.html

Derek

ForumZCLub
09-20-2006, 07:13 AM
Aww. My host doesnt have that wildcard DNS. How can they install it?


Ask The Server ADmin / Your Webhost to enable them for you .

luky
09-20-2006, 09:06 AM
Thanks alot! Will do.

swinkamorskakop
12-19-2006, 02:52 PM
please send me the file to hajbert.ekspres@vp.pl
Thank.

ForumZCLub
12-24-2006, 08:51 AM
The File is already here uploaded !

spiderd
01-16-2007, 04:10 PM
how cna u check if wildcard dns is installed ?

Derek
01-16-2007, 04:48 PM
If anything.yourdomain.com loads your site then it is, if you get a 404 then it isnt.

Choas
03-07-2007, 07:33 AM
How can i load front page from a folder ?

I mean, load a file like public_html/folder/index.php for my front page ?

ForumZCLub
03-07-2007, 10:33 AM
What are you trying to do here ?
Go to your site ..

Choas
03-07-2007, 11:31 AM
i want install nbs-multi forum script in root of my site (so i can get link such as this : forum.mysite.com). but i want when someone type my site adress, redect to a portal, as many of files of this system have the name as phpbb files, i cant put this 2 systems in my root !

it is easier than say :

i want when someone types my site adress, goes to www.mysite.com/index/index.php and when typs forumname.mysyte.com , goes to forum.

ok ?

how can i do this by this script ?

ForumZCLub
03-08-2007, 03:34 AM
okk...

This script is just acting like a redirection .
You will have to use another one in this forum ....

agent_smith
03-10-2007, 05:16 AM
|This script doesnt work. I have:

[code]
<?php
################################################## ###################
# DISTRIBUTED BY FORUMZCLUB.COM
# YOU MUST EDIT THE FOLLOWING VARIABLES:
################################################## ###################
# Your domain name WITHOUT the "www." NO TRAILING SLASHES ("easyforumz.com")
# Just the actual domain name: "www.easyforumz.com"

$domain = "easyforumz.com";

# The relative path to your users sites directory, ex:
# if your users directory is installed in yourdomain.com/sites you
# should enter only $userdir = "sites";

$userdir = "sites";

# The default page that the visitors should be redirected to if
# they don't request a subdomain or they request a non-existing
# subdomain. This page should be your main index page. You can
# simply rename your existing index.html file to main.html This
# index.php file must be the default file that users are first
# directed on your site, so you must remove any other index.html or
# index.xxx file that may conflict. The main.html page should be
# located in your document root:"http://yourdomain.com/main.html"

$default_page = "index.htm";

# Do you want to use frames?

$use_frames = "yes";

################################################## ###################
# CONFIGURATION COMPLETE... DO NOT EDIT ANYTHING BELOW HERE
################################################## ###################

$sub = $_SERVER['HTTP_HOST'];
$sub = eregi_replace("\.".$domain, "", $sub);
$sub = eregi_replace("www\.", "", $sub);
$sub = strtolower($sub);
$docroot = $_SERVER['DOCUMENT_ROOT'];
if (is_dir("$docroot/$userdir/$sub")) {
if ($use_frames == "yes") {
echo "<html><head><title>$sub</title>\n";
echo "</head>\n";
echo "<frameset cols=100%,* frameborder=no border=0 framespacing=0>\n";
echo "<frame src=http://$domain/$userdir/$sub>\n";
echo "<noframes>\n";
echo "<body bgcolor=#FFFFFF>\n";
echo "<br><br><font face=verdana size=2><center>\n";
echo "This page uses frames, but it seems that your browser does not support this feature.\n";
echo "<br><br>To move on, click here: <a href=http://$domain/$userdir/$sub>$sub.$domain</a>\n";
echo "</center></font>\n";
echo "</body>\n";
echo "</noframes>\n";
echo "</frameset></html>\n";
exit;
}
else {
header("Location: http://$domain/$userdir/$sub");
exit;
}
}
else {

include "index.htm";

}
?>
[code]

And it doesnt work. What do i do? As per your first post imake a dir myself? Did that for a forum i made and didnt work.

Choas
03-10-2007, 09:49 AM
Yes i have a problem such you :

when i use this script and enter a page address (http://mysite.com/page1.html ==> page1.mysite.com or : http://mysite.com/fo;der/page2.html ==> page2.mysite.com ) i get withe page !!!

dear ForumZCLub :

What you mean of this :


# The relative path to your users sites directory, ex:
# if your users directory is installed in yourdomain.com/sites you
# should enter only $userdir = "sites";

$userdir = "sites";


did you mean if i install nbs in a folder like mydomain.com/sites the created forums can have address such as : forum1.mysite.com,forum2.mysite.com,... or forum1.sites.mysite.com,forum2.sites.mysite.com ... ? or another ? (please explain SUBTLE)


thanks alot

Choas
04-03-2007, 12:07 PM
Is this script for creating subdomain for NBS ? I mean if someone creates a forum : http://site.com/forum1 .... then he can use http://forum1.site.com for his forums address ?

knsin0
05-05-2007, 09:44 AM
im lookin for a shared hosting that allow wildcard dns, wich one do you recommend me?