Migrating codeigniter to another server - php

I'm new with codeigniter and right now I'm trying to migrate a codeigniter application to another server. This application was in another server and now I want to move it to another server. In this server I have also a wordpress website and it works perfectly.
Firstly, what I have done it's a backup from the mysql database and from the files and I have move them via ftp to the another server under the /inventarios folder, so if I wrote on my browser
http://xxxxxx.com/inventarios
I should see the codeigniter application but what I receive it's a 404 error with the Wordpress interface
I have change the database.php and the another files from the config folder and it doesn't work. Why?. Under the inventarios folder I don't have a .htaccess file. Could you help me,please?. Thanks and let me know if you need more details.
EDIT 01
The htaccess which I have in the root folder is this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I don't know if inside of inventarios I should place another htaccess.
Thanks so much

Create sub-folder with name of inventarios in root of your host. Inside the folder upload all your CI folders(application, system, index....).
Then go to application/config/config.php
$config['base_url'] = 'http://xxxxxx.com/inventarios';

Also /application/config/database.php is to be edited

application/config/config.php
application/config/database.php
Don't forget to update .htaccess in root if there're some updates or url redirects to old domain/url

Related

Route not working properly with htaccess in laravel

I have created my application using laravel and vue.js and hosted my application on server in subfolder inside public_html,
Accessing it using url like this:
https://maindomain.in/projectfolder/public/login
but after login if i click on any link it points back to
https://maindomain.in/dashboard
and i get 404 not found in console for the api routes that are accessed for eg. accessing dashboard
https://maindomain.in/api/backend/get-dashboatd-data
My root htaccess file content is :
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove public folder form URL
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Note: Frontend is in Vue.js and backend in laravel.
Any help is highly appreciated
It seems to me like your web server is not pointing to the right folder.
Laravel expects you to serve the project from the public folder inside the project's root directory.
You're serving it from the main apache/nginx folder. That's why you need to add the subfolder and public folders in the URL to visit the website.
Check the Laravel Nginx configuration example to notice the root directory they're specifying.
Your nginx/apache server is configured wrong
You must point nginx/apache to the folder
/var/www/XXX_PROJECT_XXX/

Cakephp 3.0: rewrite .htaccess rule to allow new folder access?

I'm using cakephp 3.0 and I'm facing a problem. I upload my site on server on root level, where I place some demos which I can use for other purpose. Now issue is that when I access my site with domain name then it is working fine. But if I give any folder name which is placed on root level which is not the part of my site and is indiviual part of site. Then it is not accessible.
Below is my folder structure of root level
There a single folder named gallery is a demo. How can I allow this folder to access like this http://hostname.com/gallery or any other new folder.
My .htaccess file code is:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Please help me on this issue which is more appreciable.
Thanks in advance.
Just move your "gallery" folder under "webroot".
Try this it's worked for me.
create the .htaccess file in "gallary" folder with following content.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
</IfModule>
and try with URL http://server_name.com/gallary
You have access for that folder and files.
Thanks.

Laravel Apache URL mapping

I currently use laravel 5 for web development. And my goal is to upload the website which I made in laravel to a shared host.
But if I upload my files to the public_html folder, I'll have to navigate to mywebsite.com/public/mypage to access a route mypage. Which is not what I want.
I would have just changed the the name of public folder to public_html and then shifted all other folders to the root directory and changed some laravel config options, but that would have made my root directory unclean. So think I would have to use .htaccess for what I want. I am not familiar in using .htaccess, so how would I do this:
If the user enters mywebsite.com/mypage in the browser he gets to see the page mywebsite.com/public/mypage in the browser, but the url in the browser stays the same.
Thanks, in advance.
I also got the same problem when hosting my website in shared hosting godaddy.
I also used laravel5 frameowork and launched the site http://www.hahafunnyjokes.com
Edit the .htaccess file in the root folder where your public_html pointing
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.examplecom/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Thats it, I got my site up and running.
Replace example.com with your website name

CodeIgniter cannot find anything other than default_controller

I am very new to CodeIgniter so obviously I have problem with the most basic things. I have recently tried to implement a website on local environment. I am using WAMP and the website is in www/public_html. Now the website is working on my localhost but if I try to navigate to any other page from the default (default_controler) it returns not found like
The requested URL /public_html/signin/login/ was not found on this server
I assumed that the website was designed to resolve its path related problems by itself. I am obviously missing something very basic.
I have changed the base_url in the config.php file by the way.
$config['base_url'] = 'http://localhost/public_html/';
I have no clue where else the base_url are or where to change it. Any help will greatly appreciated.
Zain
You are getting this problem because you don't have your .htaccess file configured correctly. At the document root in your .htaccess file you need the following
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
In your config.php you will need to do
$config['index_page'] = '';
You also need to make sure you have mod_rewrite enabled
ther is a problem with your index.php. check this line
$config['index_page'] = 'index.php';
if it works u have to add an ht access file to remove index.php from ur url
there are a lot of code for .htaccess file on web try using one that suits you

Normal php in a Cake PHP app and using htaccess rewrite

I have a normal php script which I want to use in a CakePHP application (created by a previous developer). I have made a folder in my CakePHP webroot folder:
Httpdocs -> app -> webroot -> folderx
Is it possible to run a standalone script in this folder?
Also, my script takes in an id, for example www.domain.com/folderx/index.php?id=123 and draws the information (ex name of the product) from the DB. However, I wish to rewrite the URL to:
www.domain.com/folderx/name-of-the-product. Is this possible at all?
The webroot already has an .htaccess file which handles the CakePHP rewrites. Would I be able to use a new .htaccess file with the rewrite instructions in www.domain.com/folderx/ for my standalone script.
You need to modify the existing rewrite rules to not rewrite requests that include /folderx/ to CakePHP. If you need help with that and the mod_rewrite manual isn't enough, share your rewrite rules.
By default, your htaccess, in webroot, must contain:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
In this case, all the folders and files in the webroot should open normally

Categories