Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite for multiple applications
#20

[eluser]Kenneth Allen[/eluser]
[quote author="Aken" date="1328608375"]Also as an update to anyone interested, we made a mistake in that RewriteCond conditions are only valid for the next RewriteRule. Once a RewriteRule has been defined, the conditions reset back to none for the next one. So you need to duplicate RewriteCond for multiple rules.

Code:
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^admin/(.*)$ admin.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^public/(.*)$ public.php/$1 [L]

Also obay, make sure you create something to handle calls to your root folder, which would normally default to index.php (like mywebsite.com would default to mywebsite.com/index.php) - so make sure you do something to keep your main .com from having a 404 error.[/quote]

My situation is a little bit different. I have an application developed with CI called SMaLL, which has been implemented on several non-CI (but PHP based) web sites by simply adding the SMaLL folder to the root directory for the main site. By simply appending the text /SMaLL to the regular URL for the main site the SMaLL system is invoked cleanly. So if their site name was main.myhostsite.com, they would invoke my application using the URL main.myhostsite.com/SMaLL, and an RESTful portions added by my application would append to that string.

Recently I was asked to rewrite an existing site and was given approval to use CI, which I did. Now they want me to add SMaLL as a part of that site as well. So, if the URL for the new site is trial.myhostsite.com then they want to be able to use my application on their site like they did with the old one using trial.myhostsite.com/SMaLL.

Note that this is not quit the same as two CI applications in the same site, but rather one under the other.

So, as with the the previous site, I copied my SMaLL folder into the root folder for the new CI based site, but I cannot seem to convince the top level code to pass my URL requests down to the SMaLL application cleanly. For example, if I use the URL trial.myhostsite.com/SMaLL/dosomething/3, which should invoke a method named do something in the controller with the path ~/SMaLL/application/controllers/small.php, it seems to get to the default controller in SMaLL and does not pass along any of the other segments on the URL.

The following is the .htaccess file in the root of the trial site folder:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|Assets|Documents|Tutorials|Photos|Temp)
RewriteRule ^(.*)$ /index.php/$1 [L]

And the following is the .htaccess file in the SMaLL folder:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|Documents|Tutorials|Photos|Temp)
RewriteRule ^(.*)$ /SMaLL/index.php/$1 [L]

What changes do i need to make to the root .htaccess file to permit it to pass control to the SMaLL application? I tried modifying it as shown below, but that did not seem to achieve anything.
RewriteEngine on
RewriteCond $1 !^(index\.php|Assets|Documents|Tutorials|Photos|Temp)
RewriteRule ^SMaLL/(.*)$ /SMaLL/index.php/$1 [L]

RewriteCond $1 !^(index\.php|Assets|Documents|Tutorials|Photos|Temp)
RewriteRule ^(.*)$ /index.php/$1 [L]


Messages In This Thread
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 09:17 AM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 09:58 AM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 11:52 AM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 11:58 AM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:04 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:07 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:09 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:17 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:22 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 12:24 PM
mod_rewrite for multiple applications - by El Forum - 02-05-2012, 09:19 PM
mod_rewrite for multiple applications - by El Forum - 02-06-2012, 01:13 AM
mod_rewrite for multiple applications - by El Forum - 02-06-2012, 01:32 AM
mod_rewrite for multiple applications - by El Forum - 02-06-2012, 01:37 AM
mod_rewrite for multiple applications - by El Forum - 02-06-2012, 04:58 AM
mod_rewrite for multiple applications - by El Forum - 02-07-2012, 01:50 AM
mod_rewrite for multiple applications - by El Forum - 02-07-2012, 02:52 AM
mod_rewrite for multiple applications - by El Forum - 02-07-2012, 03:17 AM
mod_rewrite for multiple applications - by El Forum - 02-07-2012, 11:45 AM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 11:32 AM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 11:40 AM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 11:56 AM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 11:58 AM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:11 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:19 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:28 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:34 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:42 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 12:57 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 01:05 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 01:19 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 01:46 PM
mod_rewrite for multiple applications - by El Forum - 04-07-2012, 01:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB