I have this issue where I cant decide what's for what and what is the best. Hope someone could provide me with some explanations to clear up my confusion.
So here it is, I have a site which is quite large. Currently running on Yii Framework which I am in the process of migrating it to L5 Framework. This website has several sub sites structure like below example:
1) www.example.com
2) www.example.com/{username}
3) explore.example.com
4) explore.example.com/{organization}
5) connect.example.com
6) coin.example.com
7) m.example.com
8) e3.example.com
So the current hosting method is using 1 project to host everything. Here comes the problem, should one of the sub sites were to be disabled for whatever reason, the whole website would need to be put to a stop, code to disable the site and the deploy the entire site again.
Back to L5 Framework, I noticed that I can do the same in laravel aslo to host everything in one project using the following routing methods in routes.php:
Route::group(['domain' => '{account}.myapp.com'], function()
{
Route::get('user/{id}', function($account, $id)
{
//
});
});
Again the same question rises, if there is a sub site to be disabled, I would need to code the disable site and redeploy the whole site again. So I was thinking if it is practical to host each sub sites in a new project as a module such that if any changes to that sub site, it will only affect that particular module while the others maintain running.
Additionally I would also like to ask, if I host it as a separate project, my website requires the user to login before they can navigate to any of the pages or application. So how do I tell the other modules where the user has been logged in and everything can be proceed as usual?
Finally of course if anyone have any other suggestions or approaches feel free to enlighten me too. My main motives are to achieve:
1) Maximum development flexibility
2) Fail tolerance
3) Sub sites can share the same login with the main website
(You are only require to login at the main page and you will be authorized
to use the rest of the web application)
Thank you.
I guess, the answer will be too late. Nevertheless, it might help someone else.
Today I faced a similar dilemma myself - should I use subsites or separate applications for public site and admin site of my application.
At first it seemed that I should have separate apps to avoid bringing down bith sites if I wish to upgrade just one of them. But I did not want to duplicate all the Laravel boilerplate code all over again in my repository.
Then it came to me that actually I can implement everything as subsites, but I can deploy the Laravel app to multiple subdomains. Thus there will be single app in the repository, but I'll have a different copy for each subdomain.
Drawback - the code of controllers, views (and some site specific models) will be duplicated for each deployed site. That's not an issue for a small site - just a bunch of unused files. But if I wanted a clean solution, I could implement some modular structure and bring in site-specific MVC stuff during deployment. That's another topic, I guess. There are some 3rd party solutions for modular Laravel apps. Of course, modular solution adds to the complexity and maintenance, therefore I have nothing against file duplication on server, if that's not an issue for you.
Regarding authentication - I haven't tried it with Laravel, but I have experience with implementing cookies for top level domain in pure PHP application. Essentially, you can configure your session cookie to be effective for all subdomains, and then users will have to log-in just once in any of your sites. Here seems to be a working solution for Laravel:
Persisting sessions across subdomains in Laravel 5
Just set the top level domain to .example.com and theoretically you should be good to go. For development purposes, I'd store this value in .env, though.
Related
I have moved a website from heroku to another provider. Lets say its custom domain is www.mysite.org. It was also at mysite.herokuapp.com, although we never really used that domain, Google has indexed some pages there. I want to redirect any requests mysite.herokuapp.com/[EVERYTHING] to www.mysite.org/[EVERYTHING]. The paths are otherwise compatible. I am told Heroku does not allow you to use an .htaccess file. I've deleted the mysite project on Heroku but could create a new one thats a simple php page or something else?
I'm sure this has been asked before, i've looked but find either too little or too much information and none seems to answer my question. Thanks.
I have modified the users component of Joomla, specifically the file components/com_users/controllers/profile.php and included some custom templates in components/com_users/views/profile/tmpl
It is mostly some forms which I am submitting and then redirecting to specific pages for further actions.
Example scenario :
Above option is accessible to user right after login. I have put it on the profile page by modifying default profile template.
So when someone enters a name, and presses search, then this form is submitted through form
action="<?php echo JRoute::_('index.php?option=com_users&task=profile.selectSendMessage'); ?>"
This in turn calls the function named selectSendMessage which is placed in profile.php file. The function looks like :
As you can see the function redirects to
index.php?option=com_users&view=profile&layout=sendMessage
I have placed sendMessage.php template in com_users/views/profile/tmpl
Everything works fine on localhost which I have set up on MAMP in MacOS
I moved the website to a live server a few days ago. I have followed all proper steps to migrate website and database from localhost to live server. Still any of the custom templates I have put in are never reached.
The strange thin is that Edit User Profile which is redirected to from the same profile.php file from a function edit(), with template in the same location as I have put in edit.php in views/profile/tmpl works as expected.
I am using 1and1 shared hosting plan 1&1 Unlimited for hosting the website.
I have been trying to fix this for quite some time now, but cannot understand the problem. I have tried reinstalling the website several times, tried installing from web apps from 1&1 control panel and modifying it, but no success.
Any tips and insights are welcome. Thank you.
It turns out that 1and1.com hosting somehow doesn't support layout names with a capital letter in it. I changed all layout names to lower case alphabets and everything worked fine like it should.
If someone faces the same issue, this is worth a try. It was particularly hard to debug since you will never suspect that could be a problem. I accidentally stumbled on the solution while playing around.
Thanks.
Hey folks, working on a CI app that provides public ad well as private (secure) access. I have not implemented SSL before but i understand that part of the setup is specifying which folders should be accessed using https.
I would like some advice with regards to how i should structure my folders to facilitate that.
Does the setup only affect the controllers folder? in other words should I split my app controllers between a public and secure subfolders under the standard CI controllers folder?
Do I need to do do anything to my views and models folders? anything else I should be paying attention to?
Your help would be appreciated.
thanks
OK the best way to split things up the way you want, would be to:
Set up your CodeIgniter app under a folder, say /var/www and ensure everything is working as you want.
Set the base url for the site under the config.php of CodeIgniter to just "/".
Create an Apache virtual host for the secure portion of the site, listening to requests on port 443 or whatever. Install your certificate and so on. http://www.namecheap.com are good for certs. Set up the web root as the CodeIgniter folder, e.g. /var/www.
Create a further Apache virtual host, pointing to the same directory e.g. /var/www for the unsecure version of the website.
You will now, all being well, at this stage be able to access the entire site using either https or standard http. I think you mentioned being able to take things a step further by only allowing access to certain controllers via HTTPS and certain unsecure. What I would do for this is the following.
Create a CodeIgniter library, call it say Ssl.php, under your application/libraries folder. Put in the following code:
class Ssl {
public function require()
{
// Is the current request method secure, via SSL?
if ( ! isset($_SERVER['https']) )
{
// No. Do something here, display an error, redirect... up to you
show_error("This resource must be accessed through an SSL encrypted connection.");
}
}
}
Now, in your application controllers, simply load the library the usual way $this->load->library('ssl') and for any controller method that you wish to require an SSL connection for, simply call the $this->ssl->require() method before any execution starts.
You could even go a step further and drop that method call to require() in a class controller __construct() function, or even an entire new controller that you may wish to extend from.
I hope this helps in some way.
Hey, I am in the middle of developing a CI app that is successfully running with HTTPS/SSL.
I think you are a bit confused. As far as I know, you can only set up an SSL enabled site per se by creating a new site or "virtual host" if you are using Apache for example.
So essentially if you were using Apache, you would create a virtual host to handle requests on port 443 for say https://example.com and then set the web root to say /var/www or wherever your CI app sits. You would also have to configure Apache to use your certificate file, once you have bought the cert and downloaded the bits and bobs after generating the cert request. It's easier than it sounds.
Is there any reason why you can't just have your entire app running through SSL? Rather than an encrypted and non-encrypted section? There is a small CPU overhead for SSL but it is minimal.
I hope this helps in one way or another.
EDIT IN RESPONSE TO COMMENT:
You're welcome. It's a minimal overhead. For the hassle, I would just simple put it all under an SSL vhost. Plus, if you were to split content between SSL/non-SSL, you may notice that if you include non-SSL based content on an SSL page, users will get a pesky message in their browser about "insecure content" etc, which may put them off and create some needless doubt.
It may be quite difficult to split as you want - as you would need seperate root index.php CI files for each vhost to allow CI to route it correctly. You couldn't just set a vhost serving a directory such as application/controllers/private/ because CodeIgniter wouldn't know how to handle the request without some severe modification to it's core routing.
I would honestly just stick everything under an SSL vhost. Or, another option would be to set up two CI apps running from the same system/core CI folder... if that makes sense, but then sharing content such as libraries and models will become tedious.
I just started working with codeigniter and i found it easy to work with. I recently came across expressionEngine and seems like a great add-on for codeigniter. My questions is, after i install expressionEngine, will that change the way i work with codeigniter where code goes in controller and view in the view folder.
Apples and Oranges,
Codeigniter is a framework that allows you to create a Web Application like an admin system. The customer does not add any content or touch anything. You can add CMS functionality to your codeigniter Web Application however in this sense you are actually building your own CMS on top of your Web Application.
ExpressionEngine, built with codeigniter, is a CMS that allows clients to add content without actually giving them access to your HTML - That is not to say that you can't give them access but this would defeat the purpose of a CMS.
Because expressionEngine is built on top of codeigniter it is possible to access it's functionality (I've seen posts on this but haven't tried it yet myself).
I think you would use the two together if you had a Web Application with a Website around it. In this way the client would be able to add content to the website and even some of the Application information areas but you would use Codeigniter to build the Web Application's functionality.
I don't think it would be a waste of a week to get into expressionEngine. LevelUpTuts has some great video tutes on expressionEngine 2 and try Nettuts+ CodeIgniter from Scratch for, suprisingly, codeigniter.
(For those who are new to CMS) The general process of development is:
- Translate your website design to HTML/CMS/jQuery
- Translate your HTML to expresionEngine Templates
- Define your Channels which your clients will add content to
- Embed those Channels into your templates to display that content dynamically
- In administration, assign permissions to who can add content to which channels for your clients
It will start to make sense once you try it.
You can't layer ExpressionEngine on top of CodeIgniter since CodeIgniter is extracted from ExpressionEngine. It's EE all the way, or use CodeIgniter to build your own thing.
ExpressionEngine supports PHP code inside it's templates if that's what your asking.
EE(2.0) is a CMS built on the CI2.0 framework.
If you are familiar with CI you will be able to hack, modify and extend EE with ease, as well as develop your own plugins etc.
You can of course, have an EE installation and a CI installation on the same server, but the two do not interact directly - CI is a framework, EE is a CMS.
Not sure I would call EE an "add-on"...
EE is it's own standalone Content Management System. Generally EE and CI are not meant to be mixed. While EE is built on CI, it is not meant to be extended/changed etc... They (Ellislab) will tell you, If EE doesn't fulfill your requirements, then you need to use CI exclusively.
Plus, a 300$ license is pretty expensive for something that you view as an "add-on".
I would reccomend looking into PyroCMS, which is also a free (beer and speech) CMS built on CI that directly allows for "Module" development which is straight codeigniter development with a few added meta/installation files that would allow you to build the extra functionality you need within the Codeigniter structure.
There are four files for expression engine.
For Example i have module named "Products"
1)mcp.products for admin end or admin control panel just admin controller in pyrocms
2)mod.products front end code is placed here 3)tab.products tabs are here 4)upd.products installation code. There are views in "views" folder and model is in "model" folder in our case "products_model". Just copy your controllers methods and paste them in mcp.products.php on admin side. and copy your controllers methods and paste them in mod.products.php on front end side. in udp file place the table structure.and it will treat as you are in Pyrocms.
I googled this many times but now I have to ask it here.
I want to make a workflow for a website for Developpement/Production.
My constraint is that I use Facebook Connect (Facebook Graph now) so I need to have the dev and prod on the same domain and server. (to be able to log in and test the features)
I thought I will edit the CodeIgniter Index.php to redirect if I have a specific user agent (I can edit the one of my firefox)
You think it's a good Idea or you have a better one ?
And now comes the eternal question : how can I deploy this the easy way ?
should I use Capistrano or Phing ?
or simply a script with SVN ?
Please help me, I'm totally new to this Deployment thing. I used to work directly in production for my little websites or on other domains. but now it's not possible anymore.
For me, I'll have something like two application folders. One called "production", one called "development". Then in your index.php file, where you set your application folder, you can use php to determine which one to use for whatever reason. Just set your $application_folder variable to whichever one you need. (You could do this based on anything. A cookie, IP address or something.)