# subdomain.domain.com vs. domain.com/subdomain issues

## audiodef

I just noticed something interesting. 

I have http://radio.audiodef.com pointing to the same docroot as http://audiodef.com/radio. The former, however, doesn't pick up the stylesheet or images 

Is there a way to correct this without having to resort to using the full URL of the stylesheet and images? The reason I want to avoid this is to avoid the hassle of changing it every time I edit something on localhost and then scp it to the server.

----------

## darkphader

Could probably symlink to those two directories and drop the leading / in your source.

----------

## audiodef

 :Laughing: 

I had the same idea when I was out running, before I saw your post. 

I'm probably being dense - I sometimes can be - but how would I take care of links in the top menu? I can see on my localhost that symlinking works, but the top menu would show http://radio.audiodef.com/albums.php and such, instead of the desired http://audiodef.com/albums.php.

You'll probably say something that'll make me kick myself. But don't let that stop you!   :Razz: 

----------

## Hu

Can you not have your top menu have links of the form:

```
<a href="albums.php">Albums</a>
```

Then the browser will construct the URL relative to the server and directory of the page which contained the <a> tag.

----------

## audiodef

Symlinks gets stylesheets and images loaded... check!

But the "problem" I'm having is that whether links are "albums.php" or "/albums.php", once I've gone to http://radio.audiodef.com, I'm in that subdomain. Both "albums.php" and "/albums.php" will result in "radio.audiodef.com/albums.php" when what I want is "audiodef.com/albums.php". I can symlink all those files so it still works, but I don't want the URL "radio.audiodef.com/albums.php" to exist because there is technically no "albums" page on the radio subdomain and I don't want there to be. 

Is it possible to get all links on a subdomain to link back to the TLD without the full URL for each link? I would like to avoid having a copy of my navigation for each subdomain when it would be otherwise the same, as it would make site maintenance easier.

There's gotta be something. I can't be the first person to want to do this.   :Razz: 

----------

## darkphader

If it's just a transitioning period to radio.audiodef.com, set everything up to work properly like that and then use a redirect at the subdirectory site.

----------

## audiodef

It's not a transition. There will be a radio.audiodef.com and audiodef.com. The same appearance, stylesheets, images, etc. will be used on both. All radio.audiodef.com is is audiodef.com/radio with an apache vhost for radio.audiodef.com pointing to it. 

There's absolutely gotta be a way to not have to have duplicate files for this kind of setup.

----------

## octomancer

Hi,

The simplest way of making everything work is to redirect people from radio.audiodef.com to audiodef.com. Job done. Run your site at a single URL and redirect everything else to it.

If you have more specific requirements, please explain them and I'll try to help.

Also, I don't understand this statement:

 *Quote:*   

> but I don't want the URL "radio.audiodef.com/albums.php" to exist because there is technically no "albums" page on the radio subdomain and I don't want there to be. 

 

Technically, the "albums" page exists at whichever URL(s) Apache is configured to serve it in response to a request. What is your exact thinking here?

I'm not having a go, I just don't understand exactly what you're after ...

Octo

----------

## audiodef

Alright, I'm a frakkin' moron.   :Embarassed:   :Embarassed:   :Embarassed: 

I just did what I SHOULD have thought of to begin with, which is:

1. Make audiodef.com/radio.php the landing page for my radio station

2. Put nothing but a header() statement in /radio/index.php to bounce it back to audiodef.com/radio.php

Now I get exactly what I was after. A nice URL and maintenance efficiency. 

Color me   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed:   :Embarassed: 

Too much cream soda and hard lemonade, I guess.   :Razz: 

I really appreciate everyone's response. though.

----------

