I have a website that is currently using Laravel but i need to put inside a previous project made on codeigniter inside the website.
So my question is ...
How can i make the two frameworks work nicely with each other.
On my previous site I would use the route www.exampledomain.com/codeigniterproject and I would be redirected to a view that was inside the codeigniter project and handled by the controller.
But currently when I try to do this I get a 500 error.
I have an href trying to point to codeigniterfolder and I get the generic Laravel error "Sorry, the page you are looking for could not be found."
When i click on the link.
codeigniterfolder
My ftp looks like this ...
public_html where i have all the laravel public directory
laravelproject where everything that my laravel project requires
and then inside that folder i have the codeigniter one so the folders look like this laravelproject/codeigniterproject
Everything is set on the laravel side i have no problems with my routes or whatsoever inside laravel.
But I dont want to migrate all the codeigniter code to laravel it's just not an option, so I wanna integrate the codeigniter project inside my current laravel one.
You cannot have 2 index.php files in the same app, but you can change index.php to bootstrap Laravel or Codeigniter, according to some conditions you will set. It's not good, but it's doable.
But, really, there are many ways of doing this, the best one would be using your webserver (Nginx, Apache) and have it rewrite the url and send you to the Laravel directory or Codeigniter one accordingly.
What you cand do in Laravel is to configure a Redirect route to send to your old app, in a different VirtualHost (webserver, again):
Route::get('/oldapp', function() {
return Redirect::to('http://google.com');
});
If it is not really necessary to be in one directory, why don't you use subdomain?
You can put it simply like this:
on your laravel let's say www.yoursite.com
and on your codeigniter codeigniter.yoursite.com
Related
I'm currently building a URL shortener and am using React for its frontend. It is where my domain (let's say example.com) is linked to using Firebase Hosting.
I'm in a bit of a struggle trying to figure out the redirection part of the service, as I want this redirection to be "HTTP native"; it should not require JS to redirect, just a plain 301 redirection.
Shortened URLs look like this: example.com/go/:linkId.
When a user clicks on a shortened link, My server should get the request, find out what URL is linked to the shortened URL's id, and redirect to the original.
Since I don't want to involve JS, I tried to use the redirects setting in firebase.json. At first, it looked promising just to use:
"redirects": [
{
"source": "/go/:linkId",
"destination": "<SERVER_URL>/go/:linkId"
}
]
Two issues with this approach:
It won't work on localhost, as (AFAIK) firebase.json isn't being taken into consideration when running Webpack dev server.
Anyway, there is a different server URL for development and production environments. I don't want to hard-code the URL since it won't let me separate between them.
I was thinking about redirecting to a go.js file or something that will live in the dist folder with index.html, but It won't be resolved a node.js file.
If you have any idea how to solve this, I'd be glad to hear.
Thanks!
Redirects will work locally when you use the Firebase CLI, i.e. by running firebase serve. If you need to preprocess your source to get the final distribution, you do that locally, and then call firebase serve on the output of that preprocessing step.
I have a cakephp app inside a folder online like this: https://www.example.com/main
however, when I enter there, I want my url to show like this: https://www.example.com
I already tried modifying core.php
Configure::write('App.baseUrl', '/');
And it shows what I want but returns "The requested URL /info/inicio was not found on this server."
I know that the solution would be to just remove the folder "main" and load the cakephp app directly, but at the moment that's not possible.
I solved it by going to my cpanel and setting https://www.example.com/main as the pointer and then created a new domain that points to https://www.example.com/admin
Easy
URLs on my subdomain like react.mysite.com/page1 go to mysite.com/404.html, when refreshed, instead of the appropriate React component.
Can i have a seperate .htaccess for my subdomain? If so what would I write in it so it would look at react.mysite.com and let that handle the rest of the url?
I'm relatively new to React and SPA, so any help would be greatly appreciated.
So you can have multiple .htaccess files.
And the rule is available in this question:
Apache web server doesn't allow me to refresh on /about but on localhost its working fine
I'm experimenting with Yesod and I've created a simple scaffolding site with yesod. I've downloaded a bootstrap template site and wish to simply host this site with yesod. The template site has an index.html and a bunch of css and js files. This seemly simple task has baffled me. By my understanding, the site should be placed under the 'static' directory, I tried to use sendFile to send the index.html file in getHomeR, but only the content of the that file is displayed, without the css and js. Should I do this with a Subsite?
Thank you
Have a look in your browser console, most likely you're getting 404s due to bad relative links. I'd try using a redirect call to point to the static for so that all of the relative links are correct.
I am trying to build mu first web application with yii
From what I understood a .htaccess file must be in the project folder
in the localhost every things work fine, but when I upload the whole project my remote server doesn't accept .htaccess files and I get 404 not found (server error not yii error)
there is an alternative to this problem ?
many thanks in advance
There is no alternative when using a Front Controller pattern. Only on the http server you can redirect all wanted requests to a single central point. It is weird though that you cannot use .htaccess.
One more question: are you using apache or something else as a web server? Because .htaccess is apache specific to the best of my knowledge, for other servers you need differend configuration in differend other places.