• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WAMP - trying to have two index.php files -- admin and main

I've been struggling with this for a while. Here's what I'm trying to do. I have got this working on my Linux server but can't get it working with my WAMP5 Windows installation which prefers to use Aliases for each app instead of using a distinct VirtualHost for each app.

1. Single instance of CI for all apps -- this is working
2. index.php split into main.php and admin.php for admin and main sites.

So my directory structure looks like this (only showing tail ends of paths):

/html/public/admin.php --> these are just index.php modified to point to my single CI
/html/public/main.php --> and the appropriate application (see below)
/html/private/main_application --> this is the "application" folder
/html/private/admin_application --> ditto

Now, I would prefer to protect the admin with basic htaccess protection. I read in the thread in here about extending the Controller class with an Admin class, and extending all admin controllers from that. I'm tempted by this idea but what I have is so close (works on Linux, just can't get it working with the WAMP5 world).

My domains are like:

(and on windows box they are, for example, http://localhost/mydomain)

Both have the same docroot, but DirectoryIndex is either admin.php or main.php
In Linux I put the RewriteRules (for nice URLs) inside the VirtualHost. Technically I could do this in the WAMP5 world but I would rather not modify httpd.conf in Windows/WAMP world, so I can keep WAMP5 in a state that is easily upgradeable--only using the built-in features for Apache aliases.

So, my problem in Windows right now is the Rewrite Rules. I have tried to put them in the mydomain.conf files (WAMP creates these and automatically includes them in httpd.conf). The problem is, The rules both need to apply to the same /public directory, but there are two rules depending on whether I want to hide admin.php or main.php in the URL. So, in WAMP, whichever rule it hits first, wins.

Someone suggested my two virtualhosts should not point to the same directory, /public. I don't know why this should matter. If I create a new docroot, say /public/admin, then I can no longer access the other shared public stuff (/images, /style, /javascript).

I've been thinking about this off and on for 2 weeks. Any advice PLEASE?


OK I finally broke down and created two virtualhosts by editing the vhosts-httpd.conf of WAMP.... in case anybody else ever finds this issue.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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