Welcome Guest, Not a member yet? Register   Sign In
.htaccess for admin panel
#11

[eluser]NiconPhantom[/eluser]
Where your application is hosted? Is it your own server on WAMP/ LAMP?

Do you have any .htaccess inside blob/ ? If you will temporary remove it, will you see 403?

Sounds like: http://www.cyberciti.biz/faq/apache-403-...-solution/

#12

[eluser]noslen1[/eluser]
Yes CI is installed on my localhost on WAMP.
If I remove /blob/.htaccess, I don't get a 403 but 404 error
#13

[eluser]NiconPhantom[/eluser]
what if you will try /blob/index.php or any other file directly, will it still trigger 404?

Make sure you have mod_rewrite enabled for Apache -> WAMP, otherwise it will give 404 for .htaccess routes

I found following picture which might be useful: http://docs.tomatocms.com/images/4/40/Wa...module.jpg
#14

[eluser]noslen1[/eluser]
Of course my mod_rewrite is enabled in Apache.

I don't have index.php in my /blob directory.
My folders structure looks like :
Code:
/blob/
    /cache/
    /config/
    /controllers/
    /... //other classical directories from application folder
    /.htaccess
    /index.html
/site/
    /cache/
    /config/
    /controllers/
    /... //other classical directories from application folder
    /.htaccess
    /index.html
/www/
    /admin/
        /css/
        /img/
        /js/
    /site/
        /css/
        /img/
        /js/
/system/
    /core/
    /database/
    /... //other classical directories from system folder
/.htaccess
/index.php // routing to /site/
/blob.php // routing to /blob/

If I try to access /blob.php, I successfully arrive on my admin login page (the default login controller), then I submit the form and it's trying to send me to localhost/muki/login, instead of localhost/muki/blob/login or localhost/muki/blob.php/login
#15

[eluser]NiconPhantom[/eluser]
Do you have HMVC like https://bitbucket.org/wiredesignz/codeig.../wiki/Home? If no, then it will be easier for you to have it to separate different apps and use routing instead of .htaccess
#16

[eluser]noslen1[/eluser]
Nope I don't have HMVC. Should I get into it or should I rearrange my folder structure ?
What would be the most typical and easiest way to structure a backend application besides a frontend in CI ?
#17

[eluser]NiconPhantom[/eluser]
I am using HMVC and my structure looks like:

Applications
Modules
admin/
controllers
views
models

frontend/
controllers
views
models

So basically in routes.config I have default website = frontend/front_controller and $route['admin']= 'admin/backend_controller'

With HMVC you will have modular structure without any .htacces or php file which will route from one location to another. The only .htaccess I have is posted above and it's just to hide index.php



#18

[eluser]noslen1[/eluser]
Okkkkk I understood what you meant by not naming the folder as /admin Aken !
Folder structure :
Code:
/administrator/
    /cache/
    /config/
    /controllers/
    /...
/site/
    /cache/
    /config/
    /controllers/
    /...
/system/
    /...
/www/
    /...
/.htaccess
/index.php
/admin.php

/admin.php
Code:
$application_folder = 'administration';

/site/config/config.php AND /administrator/config/config.php
Code:
$config['base_url'] = '';

$config['index_page'] = '';

$config['uri_protocol'] = 'AUTO';

And kept the same .htaccess you gave me.

Accessing http://localhost/muki/admin throws me a 404

But, when I change URI_PROTOCOL to PATH_INFO or QUERY_STRING or ORIG_PATH_INFO, i got my login form displayed, without any style, although the called CSS localhost/muki/www/admin/css/screen.css is the correct path. Don't know if this can help you to find out the issue.
Think we're not too far from the solution.
#19

[eluser]Aken[/eluser]
If you have static assets in an /admin/ folder, you'll need to add the same RewriteCond conditions that the index.php rewrite rule has to above the admin RewriteRule. Read the comments in the .htaccess example I gave you.
#20

[eluser]noslen1[/eluser]
Ok thanks, I'll take a look at that.
And what URI_PROTOCOL should I use, and why ? What does it impact ?




Theme © iAndrew 2016 - Forum software by © MyBB