Error with controller in codeigniter named system.php

Asked

Viewed 677 times

0

I’m working on a project that’s in Codeigniter.

There is a controller called system.php that is to access the admin, only when I try to access it that way localhost/meusite/system/método, it gives access denied because it thinks I’m trying to access the system folder of Codeigniter, but if I put so localhost/meusite/index.php/system/método he accesses normal.

What I don’t understand is that the site that is on the air, is functioning normally without the index.php and here local he does not leave.

I went up to the test server, and you didn’t let me.

You’re just messing with this one controller because of the same name system, the rest is working normal.

How can I access without having to put the index.php and without giving the error that I am trying to access the folder system?

Follow my . htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>

    ErrorDocument 404 /index.php
</IfModule>  

1 answer

0


Put Codeigniter system folders and files outside the public folder (Document root)

Example

website/public/
website/public/css
website/public/js
website/codeigniter/[COLOQUE AQUI, POR EXEMPLO]

After that, set the codeigniter path in the index.php that is in the public folder, i.e., at the root of "Documentroot".

  • You tell me to change the system folder and application place and put inside an example folder codeigniter/system, codeigniter/application ? If that’s the case, wouldn’t it be in msm ? Because the controls are inside the application folder. I don’t think I understand what you posted '-

  • From what you have explained in the question, I believe the conflict occurs because the Codeigniter files are in the public folder (Document root). Just put the entire file and folder structure of frawework Codeigniter in a directory above Document root. See these links: http://ellislab.com/codeigniter/user-guide/general/managing_apps.html http://www.highermedia.com/articles/nuts_bolts/tutorial_advanced_codeigniter_installation

  • Vlws véy, this was msm :) Since I don’t have access to the site’s production server, I don’t know how the old programmer did, but it worked out what you told me. I played so codeigniter/system, codeigniter/application and was. Vlws O/

  • Good @Daniel Omine, I think I have another problem like this one. I’m using Codeigniter and only the $route['default_controller'] = 'Welcome'; it’s working, when I do an example: $route['test'] = "Welcome"; it gives me the following message Cannot GET /codeigniter/index.php/test. Do you know how to resolve this ? that folder containing codeigniter is inside another application

  • This other issue is very localized and runs away from the main focus of this page... Try creating another question explaining the problem better, with details, etc... But I think it might have something to do with rewrite Rule.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.