Welcome Guest, Not a member yet? Register   Sign In
Separate CI in subfolder on live server?
#1

Hi,

I have a CI app running from the root on my server. I've put a separate CI app into a subfolder on the same server.

http://mainapp.com
and
http://mainapp.com/subapp

Now, how do I make these two apps live together nicely side by side without the main app hijacking the /subapp part of the url thinking this is a controller in the main app?

Any ideas how to achieve this?

I've tried to add a custom route to the main app without luck. And fiddled a lot with .htaccess rewrite rules and what have you. But the main app just keep giving me a 404 page not found (as there is no controller by that name in main app) ... hmm, should I maybe make a controller and have it somehow redirect to the sub dir. If, then how?
Reply
#2

If it were me I'd use a subdomain and point it at the sub-directory. Done.

If you can't use a subdomain, like subapp.mainapp.com, then you'll want to modify your .htaccess file to redirect or rewrite all requests to the subdomain to the sudomain's index.php. It shouldn’t be that hard. Show us what you've attempted to do with the .htaccess file.
Reply
#3

(02-22-2016, 03:54 PM)skunkbad Wrote: If it were me I'd use a subdomain and point it at the sub-directory. Done.

If you can't use a subdomain, like subapp.mainapp.com, then you'll want to modify your .htaccess file to redirect or rewrite all requests to the subdomain to the sudomain's index.php. It shouldn’t be that hard. Show us what you've attempted to do with the .htaccess file.

Thanks Skunkbad, I think I generally get your point, but not being able to use a subdomain I cannot redirect or rewrite to it. What I've tried, among a lot of other things, is this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* /subapp/index.php?/$0 [PT,L]
#RewriteRule ^(.*)$ /subapp/index.php?/$1 [L]
RewriteRule ^(.*)$ /subapp/index.php?$1 [NC,L,QSA]

And all of the above without the preceding slash.

.htaccess is not a skill of mine, as you can probably see. But hey, google has all the answers, right (obviously not)?


I need to point to a subdirectory basically, therefore my question.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB