php - MVC htaccess rewrite - hide index -


i have basic mvc structure restful uri design of:

mysite.com/appdir/:index/:controller/:action/ 

and want hide index route parameter uri looks like:

mysite.com/appdir/:controller/:action/ 

my basic folder structure is:

appdir/   app/     -->controller/     -->model/     -->view/   config/   library/   public/     -->.htaccess     -->index.php   .htaccess   index.php 

appdir/.htaccess:

<ifmodule mod_rewrite.c>     rewriteengine on     rewriterule    ^$    public/    [l]     rewriterule    (.*) public/$1    [l] </ifmodule> 

appdir/public/.htaccess:

<ifmodule mod_rewrite.c>     rewriteengine on      rewritecond %{request_filename} !-f     rewritecond %{request_filename} !-d      rewriterule ^(.*)$ index.php?url=$1 [pt,l] </ifmodule> <ifmodule !mod_rewrite.c>     errordocument 404 index.php </ifmodule> 

i can't seem hide index, i've tried number of rewrite rules , nothing seems work. codeigniter, can add rewriterule ^(.*)$ index.php?/$1 [l,qsa] , problem solved i've been working on 3 hours no success.

first, request path allways starts / first rules should written this

rewriteengine on rewriterule ^/(.*)$ public/$1 [l]

then guess in public dir's htaccess should use

rewritebase /public

and - why not set public documentroot of webserver , put rules single file? in setup appdir/index.php never accessible.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -