Upgraded to 3... can't access pages |
I've upgraded to CodeIgniter 3 and followed the guide, changed all my controllers to Ucfirst. I only have 5 controllers, this isn't a huge site.
My config is as such: Code: $config['base_url'] = 'http://www.eldermaltreatment.com/' I can easily access www.eldermaltreatment.com, but cannot access www.eldermaltreatment.com/about. 404 everywhere. Any suggestions? EDITED to remove $_SERVER... based off NARF's suggestion.
Not for the 404 problem, but don't just shove $_SERVER['HTTP_HOST'] in your base_url - that makes you vulnerable to Host header injections, possibly leading to a number of XSS vulnerabilities.
If you have the index_page set, you should be accessing www.example.com/index.php/controller
http://www.codeigniter.com/user_guide/ge...x-php-file
I do not have the index_page set. Why would anyone want a URL with index.php stuck right in the middle of it?
This could be a .htaccess issue. My file: Code: # Make sure directory listing is disabled When I do add in the index.php into the URL (manually go to URL address and type http://www.eldermaltreatment.com/index.php/about), the page comes up, but none of the style sheets are linked and the page is left unstyled. Thoughts?
See if you have mod_rewrite installed/enabled on Apache, as well as if the AllowOverride option is turned on for the virtual host (if it's not you can't do anything with .htaccess).
01-06-2016, 08:28 AM
(This post was last modified: 01-06-2016, 08:29 AM by PaulD. Edit Reason: Crossed with previous post )
Hi,
Your css files are (if you inspect the source) relative links. Not knowing how you generate your URL, if you are using base_url then there is an issue with that, otherwise you just need the / at the start (one of your stylesheets is listed as .php too). The working with index and not without index is probably a .htaccess issue, but not being anything more than an amateur at .htaccess (its all voodoo to me) here is my version that I use that works on virtually every site I do: Code: DirectoryIndex index.php In fairness it looks just like yours, but with some extra bits in it (that I am not sure are needed or indeed what they do) but it works for me. Hope that helps, Paul. PS Crossed with Narf's previous post and of course, Narf is right, make sure your .htaccess is working.
Fantastic! It seems the mod-rewrite and AllowOveride All did the trick.
Appreciate all the help! |
Welcome Guest, Not a member yet? Register Sign In |