Alright, my application has been running fine for a few months now. Starting this morning all of my custom routes no longer work.
Have a controller named 'stuff' in a folder named 'mL'. Set up a custom route:
$route['default_controller'] = "mL/stuff";
Then visit 'website.com/', works fine, gets me to the 'controllers/mL/stuff' controller. Now, if I try to use a custom route:
$route['stuff'] = "mL/stuff";
and visit 'website.com/stuff' I get sent to my 404 page (as set in $route['404_override']).
This is true of all of my controllers, if I set it as the default_controller it works without issue. Someone else upgraded the server to php 5.4.9 over the weekend, and it's the only thing I can think of that might affect this, but I can't figure out how/why.
I dont think a php upgrade in itself would do this but something else must have had a tinkering.
Only thing I can think of is the htaccess or the apache config/setup has been changed - perhaps all or part of your htaccess is no longer working as a result (e.g. mod_rewite no longer enabled)
Either try restoring index.php in the config and the url to see if the page loads?
Can you check if mod-rewrite enabled. Check httpd.conf is set to allowOverride ALL for your directory and that the mod_rewrite line is not commented out.
check here for full details: http://www.tildemark.com/enable-htaccess-on-apache/
In future, if it aint broke, dont update it!
Same happened with me, couldn't figure something out but i rolled back to php 5.3.x and it will work again until we get proper update for this from codeigniter team but last update was like the below
I highly doubt that this is PHP-related. I'd guess that another
version of Apache (and mod_rewrite) is used with PHP 5.4 and I'd look
into httpd.conf and/or .htaccess
by narfbg
Related
I have 3 files, packages.php, index.php and .htaccess.
packages (hastebin is down for me), index and .htaccess. This is live here. Currently, index works as you can see by the no .php extension and the extra slash. However, if you go into Packages -> Create or Manage Packages, it takes you to piggypiglet.me/packages. I have no clue why this is? It also redirects you there when trying to manually open https://www.piggypiglet.me/minepos/admin/packages. I've tried changing the anchor to ./packages but that didn't fix it. I'm really at a loss here, I have no clue what's causing it. Also, the .php extensions are necessary as I'll be using php in the files as soon as I get this issue fixed.
Your link to admin/packages currently works fine for me. Did you solve it? Otherwise I suspect your browser might be caching the redirect from some previous version ( [R=permanent] ). Another thing that comes to my mind is trying to play with RewriteBase.
TLDR:
Recently migrated my site to a new host. The header and footer (without CSS) show up, but the pages all show "Page Not Found".
Further Explanation:
I migrated my site (small CakePHP project) to a new host, and did these steps:
And follow this steps:
Migrated every file and folder
Imported the complete database
Changed the database configuration
Checked the folders, everything is set to dirname, and stuff like that, so no problem
Now, when I access the site in the new hosting, it shows page not found, and the CSS are missing. I edited the index.php on app/webroot and added a few echos to see if the flow was ok. If I add an echo, the CSS works (if I add echos in any part of the source, the echo was echo '1';) but still with the "Page Not Found".
What version of CakePHP are you using? If it is 2.x, you need to make sure you have php 5.2.8 or greater.
The other thing to confirm is that mod_rewrite is enabled and working correctly. It sounds like this may be the issue.
Maybe you forgot to copy any of the .htaccess files.
All I want to do is be able to see a PHP file from the root without it going through the rewrites (thus our custom CMS).
Here's what I've done:
In my httpd.conf, I've commented out the call to load the mod_rewrite module.
Next, I've removed the .htaccess file from the root as it had the rewrite rules in it.
I've rebooted the server.
I've searched through phpinfo() and there are no "rewrite" strings to be found
The problem is that the server still rewrites and the request passes through our CMS.
I'm using XAMP (PHP 3.3.1, Apache 2.2.14)
What am I missing?
maybe cache problem in your browser? because a similar thing happened to me and deleting the cache solved it.
Leave it to the details... I was trying to access my_file.php on the root. However, the filename was actually my-file.php (dash vs underscore).
The page I was getting was a 404, which went through the CMS. When I access the proper file, the one with the dash, I get what I'm supposed to.
I appologize for the waste of time :)
Okey guys i have my project deployed to a subdomain folder on my server and when I try to access that subdomain -> new.mysite.com code igniter loads the 404 not found page.
It works perfectly on localhost and on a server without subdomain for example mysite.com.
Any ideas? I tried to change the base_url to new.mysite.com and it doesnt work.
Is there a way to see what url it is realy trying to load I don't know. I'm desperate i guess i have to touch the routes but what to write there?
This probably hasn't got to do with your base_url setting. If your index page doesn't get loaded, something else is probably wrong.
Are you getting CodeIgniter's 404 message, or Apache's?
In case you're getting CodeIgniter's 404 message (even for your default index page), chances are CodeIgniter isn't able to parse the relevant URL section correctly. In that case: please check (or provide us with) your .htaccess file (in case you're using mod_rewrite).
On a personal note: I've experienced such problem before too. After much fiddling and cursing, I eventually decided to just dive into CodeIgniter's system files (I believe it was system/core/CodeIgniter.php) and to alter the piece of code that reads the relevant piece of the url.
Oooops I did it again.
My site worked perfectly locally
My development machine is a windows WAMP2 setup
My server is a CentOS 5.5 APACHE 2.2 PHP5 seup
I'm getting a 404 on the codeigniter site that I've deployed, and I really can't make out what's wrong, so please help me find the error.
It's the root url. I haven't set up dns so it's just the ip address of the server. It was showing the standard apache page before I uploaded codeigniter. I've looked over the config file, and it looks ok. Could it be a file permissions error? i have set chmod o+rw in the whole /var/www/html dir. the error_log in the httpd shows nothing
I've tried testing if it was the mod_rewrite module, but I created a test directory with a .htaccess file with RewriteEngine ON that didn't give me an error, so that can't be it.
In codeigniter I've set the log_threshold to 4 in the config, but I don't get any log messages, so I can't really make out if it's a pre-> codeigniter error, but I really don't think it is, as it's loading my Error view, still Why isn't there any log being written, what's it about?
Any help would be extremely appreciated as I'm running on fumes to get this working...
Update
Thanks to #jondavidjohn I have discovered that hitting the controller directly IE:
http://addr/index.php/GeoController/markers/
Will provide me with a controller specific error saying:
unable to locate your model "modelname"
SOLVED
Thanks to #jondavidjohn, and #timdream for giving me the clues to solve this one. It was a naming problem, I had filenames that were camelcased, and they can only be small from what I understand now, so the ROUTE was innefective in that it lead to Site, but should've lead to site although I had a Site.php I had to change it and the route to site.php
make sure you have the correct settings in system/application/config/config.php.. pay special attention to
$config['base_url'] = "http://www.example.com";
Make sure you are putting in the root domain of your site, also check your routing config and make sure you have the correct default controller set in system/application/config/routes.php
I recently started using a fresh install of codeignitor 3.0 and had no problems on my dev server (Windows) then when I moved to my live server (Linux) I started getting a 404 error.
The reason for this is that in 3.0 you are meant to capitalise the first letter of your controllers/models and also the file name.
e.g.
class Test_model extends CI_Model {
Test_model.php
Hope this helps some people who end up here!
For reference:
http://www.codeigniter.com/userguide3/installation/upgrade_300.html
$config['uri_protocol'] could also play a part. It's default to AUTO, which looks for environment variable that contains the actual URL automatically.
I had a web app that fails when I switch to php-cgi from mod_php for my server. Changing the config to REQUEST_URI solves the issue. I found the valve by digging phpinfo() outputs, you could try to do that.
My first bet is that you were developing this and modified the .htaccess file.
HOWEVER, if you went from a Windows -> Linux system change (dev on Win, prod on nix) then you have to keep the Controller names in mind, if a file on windows was "Home.php", and you used "home.php" in the config as your default route, then it will fail.. as there is no "home.php" file.
Home.php != home.php
Linux is case sensitive. Check that out, it might be a simple thing but could cause snags.
Again I am just guessing due to lack of details.