Actually, I've sub folder named 'portfolio' (http://www.mysite.com/portfolio) & for that folder i'm using codeigniter but for the root directory of my site (http://www.mysite.com) i want to use laravel framework and angular.js ?
If you don't plany any shared functionality between the portfolio and the rest of your site (like a common login system for example), there's no problem with using two different frameworks. All you need is a .htaccess file rewriting all portfolio requests to CodeIgniter's front controller.
This is no problem, you only have to separate the requests on the webserver level so that some go to the Laravel framework, and some other go to the Codeigniter part.
Don't expect support inside the framework, though. It's a special solution for your special case. You have to know how to use rewriting URLs with your webserver.
Be careful with url-rewriting and set it up properly, especially for your main site (cancel rewriting for your /portfolio/ folder). Many sites uses Wordpress for their blogs, but another framework/script for main site.
Related
I'm trying to change the name from my url's to for example home instead of index.php. I've read you can do that with the .htaccess file but for that you need Apache stuff and I don't have anything like that.
Isn't there any more easy way to change the url?
Yes, there is an easy way to change the URL without using the .htaccess file. This can typically be done by using a web framework or a CMS (Content Management System) such as WordPress, Laravel, or Django. These frameworks and CMSs have built-in functionality for handling URL routing, which allows you to define custom URLs for your pages.
Another way is to use a URL rewriting module provided by your web server software such as IIS URL Rewrite for IIS web server, or mod_rewrite for Apache. These modules allow you to rewrite URLs on the server side without requiring changes to the actual file structure on the server.
Without more information about your web server, it's difficult to give more specific instructions. But you could check the documentation or the community forum of your web server or the language framework you're using to find more information about how to change the URLs in your application.
I used yii2 framework to do three sites, the three sites belonging to different servers, their layouts / main.php exactly the same, how to make these three different domain name website share this main.php?For example, a company's community and forums, as well as the official website are exactly the same layout file, which means that the three sites of the header and footer is the
same, according to my current practice, the three sites are writing this layout File and inside the style and pictures, then the problem occurs, if you want to change the footer and the title html, css, js or pictures, there will be three sites together, this is too much trouble. My current idea is to put the main.php file into one of the site's root directory, and then three sites in the frontend / layouts / main.php reference to the main.php inside the code, but how to do pictures and Style, please Experts advise?
You can include remote files using the allow_url_include directive, but this is a really bad idea because of the security risks.
In my opinion the way to go is to build a module with your layout-related files and then update it in the applications, using composer (or any other tool) when you make changes.
You could use a scaffolding like advanced template where different application (eg: backend and frontend) share common code .. Yii 2 Advanced Project Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.
By default the advanced template includes three tiers: front end, back end, and console, each of which is a separate Yii application. front end and back end app share common namespace for models and config and you can extend for place a common layout or other application based on the same guidelines
This template is also designed to work in a team development environment. It supports deploying the application in different environments.
https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/README.md
I have two websites in my local development server, 'sample' and 'example', And I have a common administrator('cms/admin') for both.
Both sites functionality will be the same, But CSS, DB and Menu layouts only different. So I have created a Backend to manage those things.And the front End will be developed based on Dynamic CSS, Menu and DB,
If I am going to run the 'sample', I will get the directory name, based on that fetch all CSS,DB and Menu template values from Admin DB and using that will showed the sites, This is concept.
Directory Structure
cms
whole Project(Developed by CAKEPHP)
sample
.htaccess
example
.htaccess
As of Now, I have created Administrator.
When I am going to run a 'sample', It will goes to sample directory, there is .htaccess, that .htaccess will redirect to main cms directory, which have all functionalities.
So the URL remaining('sample') the same, But the functionality will from the main Directory (cms).
So please advice me how to do that? Is this possible or Is there anyother way to implement this concept. The whole project will be developed by CakePHP only.'
Thanks in Advance.
I think you should change conception of application:
Seems it should be one cakephp application,
Application should use cakephp themes in beforeFilter of AppController.php you should check $_SERVER['HTTP_HOST'] and use one or another theme
in AppModel you can use right database config.
for admin panel ( cms) seems you should use admin routing check it here
I'm refactoring an old project developed in procedural PHP, with a new object oriented approach with Zend.
The website have two main section:
- Miscellaneous pages, lots of old pages still online on the main domain (www)
- A forum section, the part i refactorised with Zend on a forum subdomain
The goal is to refactor the whole website on a main Zend project which would cover the two subdomains.
Now i have to refactor some of the pages of the main domain, and because the domains have separated virtualhosts: the www domain is set to a specific directory and the forum domain is set to another directory (the Zend one), each one with custom URL rewriting.
The obvious solution would be to merge the old pages directories with the forum directory, but i can't because it would break the folder architecture of Zend.
The ideal solution would be to add a regexp clause in the main domain's vitualhost to redirect some urls of the www to the directory of the Zend project directory, but i haven't find a way to do it yet.
Is there a other way? I also can create some temporary subdomain to host the refactored pages but it's not an elegant solution.
I don't get it.
Why don't you make a clean refactor on your local env, then deploy it and make the DNS migration ? Why would you make old and new pieces of code cohabit ? You said it : "The goal is to refactor the whole website on a main Zend project which would cover the two subdomains". Then go on ! Refactor, deploy, and redirect the old domain names to the new one !
Finally, i choose a mixed solution, i'll use temporary subdomains for some parts until i could refactor in one time the rest of the old pages.
Hello stackoverflow community,
I've got a little Problem with my CodeIgniter.
I use two applications in my app folder. The first one is the frontend, the second one the backend.
In my root directory I've two .php files. An index.php leading to the frontend directory and a backend.php leading to the backend directory.
Since I use mod rewrite in order to get clean URL's there is a problem with that.
The URL structure is the following: www.domain.com/controller/action
That's the action of the controller in my frontend Application.
I use htacces to get rid of the /index.php/ between domain and controller.
To access my backend application I want my URL to be like this www.domain.com/admin/controller/action
therefore I have this rewrite rule:
RewriteCond %{REQUEST_URI} ^admin.*
RewriteRule ^admin/(.*)$ /backend.php?/$1 [L]
Now the problem:
CodeIgniter assumes that /backend/ is the first URI segment, and wants to treat it mistakenly as my controller.
Do I really have to edit the core of CodeIgniter in order to tell it not to use the Server Request URI or is there another trick?
Thanks in advance,
Thomas
This really isn't going to work. Check out config/config.php and config/settings.php etc for constants that need setting... You really need to run each application in a separate 'application' directory. It's also worth asking yourself if they even need to be 'separate' applications...
Basically, stop going down this path while you still can, it will lead to heartbreak, and reams of horrible code.
Instead of having two application folders I would suggest having a folder within the controller called 'admin', you could also have folders within your models, views (even libraries) named 'admin' which you could then pull out of this project and move to other projects.
This would allow you to just use a standard rewrite to remove the index.php from the URL, and domain.com/admin would point to your admin folder within the controller.
You just need to be sure not to have a controller within the root controller folder named 'admin.php' or you will run into issues.
For more information take a look at: Organizing Your Controllers into Sub-folders within the CI docs.
Also note that an out of the box MVC framework might not always be best used for creating a CMS. Typically an MVC framework is best used to quickly create web applications which have fairly static routes pointing to specific controllers. CMS's on the other hand tend to give full control over the website, which leads to database driven routes which often eliminate the need for typical controllers unless you have a heavily modified routing system.