Joined: 20 Aug 2003
Posts: 5341
Location: Nottingham, UK
Posted: 01/05/04 07:43
Hi
Because I have only a relatively small number of bands on my JR site, and because the 'nice band names' feature on my server isn't working (not criticing Sully - I know you're working on it ), I want to set up a folder for each band, with a simple index file in each one to redirect browsers to the appropriate JR site ie.- someone accessing www.mysite.co.uk/BandName (or even www.BandName.mysite.co.uk if possible?) will be seamlessly redirected to www.mysite.co.uk/jamroom/bands/X.
Can this be done? Does anyone have any sample html or php to do this?
Many Thanks
Pash
Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA
Posted: 01/05/04 09:38
pasher:
Hi
Because I have only a relatively small number of bands on my JR site, and because the 'nice band names' feature on my server isn't working (not criticing Sully - I know you're working on it ), I want to set up a folder for each band, with a simple index file in each one to redirect browsers to the appropriate JR site ie.- someone accessing www.mysite.co.uk/BandName (or even www.BandName.mysite.co.uk if possible?) will be seamlessly redirected to www.mysite.co.uk/jamroom/bands/X.
Can this be done? Does anyone have any sample html or php to do this?
Many Thanks
Pash
# Your domain name WITHOUT the "www." NO TRAILING SLASHES ("/")
# Just the actual domain name: "yourdomain.com"
$domain = "YOURDOMAIN.com";
# The relative path to your users directory, ex:
# if your users directory is installed in yourdomain.com/users you
# should enter only $userdir = "users";
$userdir = "users";
# 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"
$sub = $HTTP_HOST;
$sub = eregi_replace("\.".$domain, "", $sub);
$sub = eregi_replace("www\.", "", $sub);
$sub = strtolower($sub);
if (is_dir("$DOCUMENT_ROOT/$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";
}
else {
header("Location: http://$domain/$userdir/$sub");
}
}
else {
if (!$REQUEST_URI || $REQUEST_URI == "/") {
header("$DOCUMENT_ROOT/$default_page");
}
else {
header("Location: http://$domain$REQUEST_URI");
}
}
?>
Pash: It may help you to have wwwband.yoursite.com instead by uploading it as the index.php file, pointing the folder to the one Brian shown before here.
BTW, may be it helps Brian to setup a subdomain feature for JR.
Hope it helps
Joined: 20 Aug 2003
Posts: 5341
Location: Nottingham, UK
Posted: 01/06/04 07:29
Hi Cabaz
If I can just be clear on this before I try anything -
If I put your code (with the variables set accordingly) as my index.php, and then what do I put in the User folder? - all the 'bandname.html's, or 'bandname/index.html's? And presumably these html files each contain Brian's redirection code?
And this would allow domain names like 'www.bandname.mysite.co.uk'?
Also
Quote:
Here is a full code for those who can setup wildcards DNS in their servers:
Hi
Im not the best with servers and php, but this one works like this:
First you need to have wildcards DNS in your server, to check it type something like
http://xyz.yourdomain.com
if you get a default server page it have them, if you get an error page it not.
They can be setup from the server (Im using Plesk) by adding a DNS record like
*.yourdomain.com - A - 123.123.123.123 (server IP)
Or ask your hosting to know if they can setup for you.
Then, copy the code and save it as index.php and upload to your root (it must be the default page for the website)
Create a folder named "users" or what you want (users is the default one in the code I sent you)
Then add there subfolders like "myband" , "hisband", "herband" and so on. Each folder should have a index.html or php file containing the Brian´s redirection he sent you
Finally, you will able to reach the band website created by JR in the foll format:
http://myband.yourdomain.com directly from the browser.
If no folder exists with the subdomain asked i.e. http://xyz.yourdomain.com then the default main page will load showing yourdomain main page
Joined: 20 Aug 2003
Posts: 5341
Location: Nottingham, UK
Posted: 01/06/04 08:48
Hi Cabaz
Thanks for that - fully understand how to do it now, but I've fallen at the first fence, so to speak - 'xyz.motagator.co.uk' cannot be found.
Hey Sully (mine host), is this something that can be done, or is it all still tied up with the 'nice band names' problem?
Cheers
Pash
Joined: 20 Aug 2003
Posts: 5341
Location: Nottingham, UK
Posted: 01/06/04 09:35
I'm running JR on a shared box, so it all may not be possible - I'll ask my host anyway.
But it is all working now as 'www.motagator.co.uk/bandname' which is fine for the moment.
In fact, over the years, I've noticed that when you tell people, or even write down for them domain names like 'bandname.motagator.co.uk', they'll still put the 'www' in, then complain that it didn't work (such is the www ingrained in web culture)
So how it works now is arguably better in the long run, but this way could still be an interesting option to have.
Cheers
Pash
Pasher, you already have subdomain capabilities with your hosting package. You can easily just set up myband.motagator.co.uk and have it point to their jamroom folder.
I have set up a sample config to show you just exactly what I mean.
Try going to http://collab.artistcollaboration.com and see what you get. That points a subdomain right to a jamroom users band site. This actually points to jamroom/bands/X but the user never knows that.
It's easy to set up and it's included with your package.
If you look at the both of the pics by right clicking to get their location they have exactly the same file info and path info, cept the sub domain one does not work.
My question is this Brian, all three of these sites are on the same box, and therfore it can't be a server issue. All three sites are running the exact same level of code (JR v2.0b3), and therfore have the same level of SQL datebases.
The only thing I can think of in this case Brian is that there is a second level domain name being dealt with here (i.e. motagator.co.uk) and the others are first level domain names. (i.e. artistcollaboration.com) Does your code parse or do anything with the domain name or explicit path? I don't think so, but I am at a loss to understand how the software won't see the images but will see the other info, of course, the rest of the info is now in the SQL DB if I am not mistaken.
So what is it about the images that is so unique in this case??? Is this a case of deep linking not working???
Drizzle Drazzle Druzzle Drone.... Time For Zeez One To Come Home....
Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA
Posted: 01/08/04 12:12
DS_Sultan:
The only thing I can think of in this case Brian is that there is a second level domain name being dealt with here (i.e. motagator.co.uk) and the others are first level domain names. (i.e. artistcollaboration.com) Does your code parse or do anything with the domain name or explicit path? I don't think so, but I am at a loss to understand how the software won't see the images but will see the other info, of course, the rest of the info is now in the SQL DB if I am not mistaken.
Since Jamroom gets the URL of the site it is running on from PHP, PHP can be "confused" in trying to get the REAL url, based on settings in the php.ini. You can overide the settings Jamroom uses, by modifying the jamroom/config/settings.cfg.php file, and changing the top two settings from "detect" to the actul path and URL to jamroom. So for example, lets say your jamroom site is in /home/pasher/public_html/jamroom, and the URL is "http://www.motagator.co.uk/jamroom". You would modify the settings file to look like this:
Code
#-----------------------------------------------------------------------
# PATH SETTINGS
#-----------------------------------------------------------------------
# Jamroom will try to auto-detect the path that it's scripts are running
# in, but on some servers this may not work 100% of the time. Leave
# this at the default unless Jamroom tells you to change it. Default is
# "detect" - any other value and Jamroom will attempt to use it as the
# ABSOLUTE path to the jamroom scripts. Note that this must be the
# absolute path - i.e. /full/path/to/jamroom (note no trailing slash)
$config['jamroom_path'] = '/home/pasher/public_html/jamroom';
# if the $config['jamroom_path'] setting has been set to something OTHER
# then detect you must enter the URL for Jamroom here as well so Jamroom
# knows how to resolve relative URLS within its scripts. Leave this at
# the default "detect" unless you have modifed the value above this one.
# if you do need to put an entry in, put it in like so:
# http://path/to/jamroom - note there is no trailing slash "/".
$config['jamroom_url'] = "http://www.motagator.co.uk/jamroom";
This will make it so Jamroom does not have to "figure out" where its at every time, and will always use the path and URL given in the config file.