Solved

How can I set up a virtual director?

Posted on 2009-05-06
6
242 Views
Last Modified: 2012-05-06
I want to create a dynamic where a radio station can offer to their users a URL that will connect them to a page within countryshowdown.com. Ideally, I want that URL to be countryshowdown.com/WKKY. In other words, I want to know how I can set things up on my server so WKKY can plug that URL in and be redirected to a countryshowdown.com/radio_station.php?id=14. Can I do this without having to create 420 individual folders, each named after a station's call letters.

When I go out to youtube, for example, the URL is youtube.com/brucegust. I doubt they have a directory on their server entitled, "brucegust," but how are they doing it and how can I create the same kind of dynamic?
0
Comment
Question by:brucegust
  • 2
  • 2
6 Comments
 
LVL 2

Expert Comment

by:joshlunsford
ID: 24318577
This is done in apache using the alias directive.


Example - you would put this into the http.conf file
Alias /john "/path/to/john"
0
 

Author Comment

by:brucegust
ID: 24318602
I'm familiar with phpMyAdmin and I've got cpanel - where I do I go to access the alias directive?

Also, if I've got 422 stations, will have to do this 422 times?
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 24400746
brucegust,

This goes into something that I haven't been able to make my expertise yet but I can try to help.  Also I will have a zone advisor move this to another zone or two to try to attact some of the experts who can help more.

This is something you will need to do in httpd.conf or maybe the .htaccess file.  However it seems like more of a mod_rewrite solution to me than Alias.  Do you have to have the id number or can the radio station letters (i.e. the part you want to show in the URL) be used.  What I mean is can the URL a person sees and types be ...

countryshowdown.com/WKKY

... while the server takes them to the file radio_station.php and uses the query string like ...

?name=WKKY

If this method is acceptable then I believe the lines below will do it.

RewriteEngine On
Rewrite Rule /(.+) /radio_station.php?name=$1

This would assume you would not have any subdirectories on the site and ever need a URL like countryshowdown.com/folder/filename.php .  If you would need something like that then you'd need to provide a condition in the rewrite so it was only used when a name was used.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 

Author Comment

by:brucegust
ID: 24400919
Thanks!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 24413744
brucegust,
Did my expert comment help?  Your response of "Thanks" wasn't real specific.
bol
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now