I made a backoffice module using codeigniter for one of our websites and I've put it into a folder called backoffice. The website itself does not use any framework, its just a couple of static websites, some of them reading some data from database. It does not have any .htaccess file or any routing.
When I try to access the backoffice it does not work. The error log says it is trying to get my default controller from outside of the subfoler:
File does not exist: /usr/local/apache/htdocs/home, referer: http://64.91.226.165/~captainj/backoffice/
What can I do, did you meet this kind of problem so far?
Thanks
AS YOU CAN SEE I AM ACCESSING THE DOMAIN THROUGH IP ADDRESS AS THE DNS IS NOT SET YET
UPDATE:
I just found out that this is happening only when I try to access the module through IP address. I have copied it on another server and accessed by domain name and it works. But I still need to get this work using IP address.
try removing the url bad part with htaccess removing also index.php:
RewriteEngine On
RewriteBase /~captainj/backoffice/index.php/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Related
I have read a lot on stack about rewriterule and how it applies and I've tried reading up on some good articles online but I still cannot wrap my head around a few things.
I have blogs setup where all folders are in
https://domain.ca/posts/post-tree/*
So I've setup htaccess like this
RewriteRule ^posts/post-tree/(.*)$ /index.php?$1 [R=301]
As I'm sure you can guess this basically brings me root index.php where I catch this request with a $_GET to know the name of the blog folder it was requesting.
This is fine I can hit index.php and with $_GET I know the blog page they requested.
What I do not get, and I've tried a lot of things, is once I have this request in index.php how do I re-write the URL to show something like https://domain.ca/blogpage/ instead of looking like https://domain.ca/index.php? where https://domain.ca/blogpage/ does not really exist of course, but it is because I want to hide the http://domain.ca/posts/post-tree/ path.
Its a little like when wordpress processes a blog page with the id and after rewrites the url to whatever slug is set for that blog page. at least my understanding of it as they don't have individual folders for blogs, but I do.
I finally got this working with the following in the htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# the above checks if file or folder exists, if not the below is processed
# this will route to base index file and fetch $1 folder via $_GET
RewriteRule . /posts/post-tree/index.php?$1
I am trying to develop using CI for the first time. I have not changed any defaults WRT paths, .htaccess, etc. Two hours ago I was able to load pages; now I am not. All of this is on a virtual box running on my Mac, and I had been messing with the virtualbox settings in order to try to get the web pages to load while connected to a VPN (did not succeed). At no time did I edit any files on the VM, whether for connect settings or related to CI and my project.
Giving up with the VPN, I returned to my project to continue with code enhancements. Only now, as my title suggests, nothing will load. The default "It works" page loads so I know nginx is responding to requests. I don't get the Code Igniter 404 page -- I get the generic:
Not Found
The requested URL /index.php/c_login/ was not found on this server.
In this example, c_login extends CI_Controller and displays a view in its index function.
Based on my searches:
My config.php contains $config['uri_protocol'] = 'REQUEST_URI';
There was no .htaccess file previously, and that is still the case
I don't understand the bit about capital first letter in my controllers, as I've had lower case since I started the project and had no problem
Except for a minor change to a view file (not trying to load that one right now), nothing has changed since the last pull from the git server
I had left the welcome_message view and welcome controller in place when starting this project, and that no longer works either. Any ideas? I am at a complete loss.
Change this
In your config.php
$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
then in .htaccess(this should be place out side of application folder)
RewriteEngine on
Options -Indexes
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
EDIT 01
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
I am working on a site, which is built with CodeIgniter.
I have never used the framework before...I've learnt a little bit in the last couple days but really cannot solve my problem.
I have downloaded the site and I want to upload it to my own domain so not to make changes to the live site before testing.
the original site is example.com.
I want to upload it to mysites.com/examplesite (this will be the base - I use this domain for all my clients' test sites).
I have moved all the files and the database is in place.
I have found the database configuration file and have successfully edited it.
I am having trouble getting the site to work, I think it must be because of the site now being down a directory level.
I have edited $config['base_url'] so that it is correct...I am pretty sure it is correct because I can now reach the homepage where I couldn't before editing that variable. But, i can only reach the homepage - when I click on a link to another page, I get 500 error Internal server error.
Does anyone have a quick fix for me?
Thanks!
Keep this code on your project's root .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /examplesite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I had turned Use URL rewriting to ON
Added some code in to the ht access file and this never worked.
I then turned off url rewriting and removed the code and now when I try to go to the website I am getting a 404 error.
I can still access /administration
the website is www2.daxtra.com
the page it should find is http://www2.daxtra.com/index.php/home
Does anyone have any ideas what has happened?
This was the code I added:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Thanks
Right, I've done a small test.
To get what you want, you need to following:
htaccess.txt (you don't need a .htaccess file)
Search Engine Friendly URLs set to On
Use URL rewriting set to Off
You finally need to ensure that your Homepage menu items it set to a specific component such as an article or something else, not an Alias
This will ensure that you get example.com/index.php/home
Hope this helps
I have a copy of PHP project running using CodeIgniter framework. It's hosted in some server and when I am trying to access a particular URL
www.xxxdomain.com/member/member/index
The above URL is loading a page with CSS
it I call the same link in the below manner still the page is loading but it couldn't load CSS
www.xxxdomain.com/member/index.php/member/index
now, when I download this code and trying to run in my own localserver when I am trying to call as http://localhost/project1/member/member/index I am getting an 404 error at the same time when I call it as http://localhost/project1/member/index.php/member/index the desired page is loading but loading without CSS.
How come the page load with the same URL in my server and not running in my localhost?? I changed the base_url setting and I am pretty high sure that I replaced all instances with the localhost url instead of server url but still the issue persists.
Any idea how to fix this?
create a file .htaccess in your root CI folder in you localserver...
and paste this Rewrite code..
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
if you want to read more about htaccess..
make sure u leave your config index_page blank....$config['index_page'] = "";