Solved

How can I set up a virtual director?

Posted on 2009-05-06
6
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

632 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