Subdomains


English documentation further below
Om dette script
Egenskaber
Hent
Systemkrav
Installation
OSS
Ophavsret mm.



Om dette script


Subdomains er et script, der gør det muligt at lave underdomæner på ens netsted. Når scriptet først er installeret, er det meget let at lave et nyt underdomæne: Man skal bare lave en mappe. Hvis man f.eks. opretter en mappe, der ligger på http://netsted.dk/mappe, så vil man automatisk få følgende underdomæne: http://mappe.netsted.dk.



Egenskaber






Systemkrav






Installation


  1. Først skal filnavnet på din forside ændres. Forsiden hedder på nuværende tidspunkt sikkert noget med "index.html", "index.php", "default.html", "home.html" eller lignende, men den skal altså ændres til at hedde noget helt andet, f.eks. "forside.html".
  2. Indlæs scriptet (index.php) i en teksteditor og ændr indholdet af variablerne øverst i scriptet. Variablen $domain skal være navnet på dit domæne, f.eks. "mitdomaene.dk". Der må ikke være "www." foran, og der må heller ikke være nogen skråstreger. $default_page skal vare navnet på din forside, f.eks. "forside.html". $use_frames skal være enten "yes" eller "no".
  3. Brug et FTP-program til at overføre scriptet til serveren. Filen skal placeres i dokumentroden. Det vil sige, at man skal kunne få fat i filen ved at indtaste http://netsted.dk/index.php i sin browser.
  4. Nu kan du så prøve, om det virker.
  5. Når du vil oprette et nyt underdomæne, så skal du bare oprette en mappe i dokumentroden. Mappenavnet må ikke indeholde store bogstaver.




OSS






Ophavsret mm.







About the script
Features
Download
Requirements
Installing the script
FAQ
Support
Copyright, etc.



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





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:




Installing the script

  1. 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", but you need to change the name to something else, i.e. "welcome.html", "front_page.html", "page_1.html" or something similar.
  2. 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.
  3. 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.
  4. Now you can try it out. If it works, you're done. If it doesn't work, check the FAQ.
  5. 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.




FAQ

When I enter the URL to my web site, the browser shows a directory listing (a list of all files in the current directory).
You need to add the following line to the .htaccess file:

DirectoryIndex index.php index.html index.shtml index.htm

See the .htaccess question in this FAQ if you don't know how to do this.

When I enter the URL to my web site, the browser shows a white page with a lot of PHP code.
You need to add the following lines to the .htaccess file:

AddType application/x-httpd-php .php
AddType application/x-httpd-php3 .php

See the .htaccess question in this FAQ if you don't know how to do this.

How do I edit the .htaccess file?
Well, first of all you need to establish whether there's a .htaccess file in your document root or not. This can be done be performing the following test: Point your browser to http://yoursite.com/.htaccess (note the dot before "htaccess"). If you get a 404 error (File Not Found), there's no .htaccess file in your document root. However, if you get a 403 error ("Forbidden"), there's a .htaccess in your document root. If you don't have a .htaccess file, you will need to make one. Open a text editor, click "New" and write the necessary lines (the lines are shown elsewhere in this FAQ). You should not write anything else besides these lines -- no HTML tags, no PHP tags, etc. When you're done writing the file, upload it to the server and place it in the document root. Perform the test above to make sure the file has been placed in the right location. If there's already a .htaccess file in your document root, all you need to do is load this file into a text editor and add the appropiate lines at the bottom of the file (the lines you need to write are shown elsewhere in this FAQ).

What's the advantages and disadvantages of using frames when redirecting?
There's one big advantage to using frames: The location bar in the browser does not change. I.e., if the visitor enters http://dir.yoursite.com, this URL will remain in the location bar even though the real location is http://yoursite.com/dir. If you don't use frames, the URL in the location bar will change to the actual location (http://yoursite.com/dir in this example). The disadvantage to using frames is the fact that the title of the page will not be shown. Instead, the location will be shown in the title bar. I.e., if the title of the index.html file at http://yoursite.com/dir is "My page", then this title will not be shown if you are using frames. Instead the following title will be shown: "yoursite.com/dir". Another disadvantage of using frames is the fact that visitors cannot bookmark the sub pages of the main page.

What's the difference between the sub domains generated by the Subdomains script and real sub domains?
The price! "Real" sub domains are expensive. If you were to ask your web hosting company to create a sub domain for you, the company would have to change the web server configuration files as well as the DNS server setup. This will of course cost you a lot of money. And this is just the price of one sub domain! With Subdomains you can create as many sub domains as you want. However, "real" sub domains does have one big advantage which those created by the Subdomains script don't: With "real" sub domain, visitors to your web site can enter a URL like this: http://subdomain.yoursite.com/somedir/somepage.html. This will not work with the sub domains created by the script -- only http://subdomain.yoursite.com will work. If the visitor enters the URL http://subdomain.yoursite.com/somedir/somepage.html, he/she will be redirected to http://yoursite.com/somedir/somepage.html.



Copyright, etc.

This script is released under the terms of the GNU General Public License (also known as "GPL").