Welcome Guest, Not a member yet? Register   Sign In
Problem loading externals with subdomain
#1

[eluser]minoflow[/eluser]
Hello, I'm having a problem loading in anything that sits outside of the code igniter application i.e. (css / javascript). I realize my issue isn't entirely Code Igniter but I figured I could find some help in these forums. I apologize for the lengthy post but I want to give you the most detailed explanation possible.

So I basically have two apps within my CI files. The main app sits at www.domain.com and informs the public about the application, users then sign up there and are given their page at whatever.domain.com. To test locally I created an account called 'test'. I'm developing on a Mac running 10.5. In my .conf file I have the following to test locally.

Quote:<VirtualHost *:80>
DocumentRoot /Users/jonathanminori/Sites/portfolio/main_index.php
ServerName portfolio.site
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /Users/jonathanminori/Sites/portfolio/portfolio_index.php
ServerName test.portfolio.site
</VirtualHost>

My folder structure in my app is setup like this...

portfolio/
...main_index.php
...portfolio_index.php
...system/
......application/
.........main/
.........portfolio/

This allows me to have two apps within one (main is for the site where people can sign up and learn about the product, and portfolio is the product). As you can see if they type in test.portfolio.site it directs them to portfolio_index.php which then directs them to the portfolio controllers/views/models etc.

This all works fine and great.

In portfolio/system/portfolio/config/config.php I have the base_url set as "http://".$_SERVER['HTTP_HOST']."/";, which spits out http://test.portfolio.site/

My issue is when I use base_url to load in javascript in my views it won't work. It can't find the js folder when you type in http://test.portfolio.site/js/jquery.js

I know the problem lies in the .conf file because if I change it to.

Quote:<VirtualHost *:80>
DocumentRoot /Users/jonathanminori/Sites/portfolio/
ServerName test.portfolio.site
</VirtualHost>

...it can find the js file at http://test.portfolio.site/js/jquery.js.

My question is how can I go about fixing this? Should I place my css/javascript files within the "system" folder? That seems odd to me?

or

Is there a better way to handle this than what I'm currently doing? This is my first project where I'm handling subdomains so this is my first crack at it.


Wheew thanks for making it this far! I appreciate any feedback and I'm glad to share more code in this post if it helps.

Thank you!
#2

[eluser]minoflow[/eluser]
Sorry to make the dummy reply but has anyone run into a situation like this before?




Theme © iAndrew 2016 - Forum software by © MyBB