.htaccess issue on new CI build

#1
[eluser]excitedcroc[/eluser]
Good afternoon,

Could anyone help me on this problem I am having? I have been struggling with server configuration for a site I am trying to put live which is hosted on bluehost.com.

They dont allow virtual hosts or httpd access so I'm trying to use htaccess rewrites to get this working.

Code:
<VirtualHost *:443>
     ServerName team-bupa.local
     DocumentRoot "C:\xampp\htdocs\site\www\public"
          <Directory "C:\xampp\htdocs\site\www\public">
           Options Indexes FollowSymLinks Includes ExecCGI
           AllowOverride All
           Order allow,deny
           Allow from all
      </Directory>
</VirtualHost>

Everything works fine localy with the above virtual host set up. I just can't seem to get the rewrite rules to do the same thing..

My build is:

Code:
- Ci Folder
  - www
    - system
    - application
       - config
       - controllers
       - helpers
       - libraries
       - models
       - views
    - public
       - images
       - css
       - js

Any help really would be massively appreciated !

Many thanks

ExcitedCroc

#2
[eluser]Crimp[/eluser]
I can see a lot of issues here - but the question is: what are you trying to achieve and failing at?

#3
[eluser]excitedcroc[/eluser]
Thanks for the reply !

hmmm issues ?

ignore the '<VirtualHost *:443>' line it should be *:80 ...


I am trying to achieve a way of hosting more than one CI project on my server..

I would like to have each project in its own directory within the base directory.

I have now changed my file structure to the standard one as CI comes when downloaded. Everything works fine as long as my install is in the base directory. However this means I can only have 1 site on the server!

How can I put many sites on the server and have .htaccess redirect to the correct one by the first part of the url

Code:
- base_dir
   - site_1
   - site_2
   - site_3

www.address.com/site_1
www.address.com/site_2
www.address.com/site_3

Any ideas... I'm not even sure this is possible using purely the .htaccess file? Like I said tho it is my only option with bluehost.


Many thanks for your reply.

Chris

#4
[eluser]Crimp[/eluser]
http://codeigniter.com/wiki/Multiple_Applications/

#5
[eluser]excitedcroc[/eluser]
Excellent, this is deffinately what I'm after.. I now have my directory set as follows
Code:
/webroot
    /application/
        /site_1/
        /site_1/
    /system/

in index.php I have set the application var to be application/site_1 and it works great..

However if I wanted to change index.php to site1.php and then also have site2.php which point to the two seperate applications how do I go about editing my .htaccess file to accomodate? At the moment it just loads index.php no matter what !

My current setup is as follows ...

Code:
RewriteEngine On

AddHandler application/x-httpd-php5 .php

RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

RewriteCond $1 !^(index\.php|images|css|js|upload|vanilla|flash|robots\.txt|admin_html|plugins)
RewriteRule ^(.*)$ /index.php/$1 [L]


Thanks loads for the link really appreciated !

Chris

#6
[eluser]excitedcroc[/eluser]
ok so I now have 2 applications running symultaneously...

Code:
/webroot
    /applications
        /app1
        /app2
    /system
index.php
app2.php


So the index.php file loads up the app1 directory and works fine as it is using the default index page and therefore the url is just www.mysite.com/controller/function/params

However app2 has to run on www.mysite.com/app2.php/controller/function/params

This is working just fine, but the url looks a bit wrong with the '.php' bit in the middle...

Any ideas how I can change my config or htaccess to make the url just www.mysite.com/app2/controller/function/params ???

My configs are as follows

.htaccess
Code:
RewriteEngine On
AddHandler application/x-httpd-php5 .php

RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

RewriteCond $1 !^(index\.php|app2\.php|images|css|js|robots\.txt|admin_html|temp|uploads|plugins)
RewriteRule ^(.*)$ /index.php/$1 [L]

app1 config file
Code:
$config['base_url']    = "http://mysite.com/";
$config['index_page'] = "";

app2 config file
Code:
$config['base_url']    = "http://mysite.com/";
$config['index_page'] = "app2.php";



Would really appreciate any ideas or suggestions on this !

Many thanks

Chris


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.