.htaccess - Codeigniter at subfolder and htaccess for inner redirection -
i have project custom engine @ backend, i'm trying hook every request @ /somewhere/
codeigniter. put ci /www/somewhere/
, configured codeigniter's .htaccess new rewritebase, looks like:
adddefaultcharset utf-8 options -indexes <ifmodule mod_rewrite.c> rewriteengine on rewritebase /somewhere/ directoryindex index.html index.php rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /index.php?/$1 [l] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ /index.php?/$1 [l] </ifmodule>
my ci creates static html project , stores @ /compiled/
, have structure
/www/ /custom-engine/ /img/ /js/ /somewhere/ <--- ci's root /application/ /system/ /compiled/ <--- storage html my-file.html /my-compiled-folder/ /one-more/ /sub-compiled/ index.html
and works fine. but. need open compiled files without /compiled/
in url.
works: http://domain.com/somewhere/compiled/one-more/sub-compiled/
need: http://domain.com/somewhere/one-more/sub-compiled/
i needn't redirect compiled folder/file, open it. need add .htaccess. want keep access ci. example have controller helloworld
, accessible http://domain.com/somewhere/helloworld/
(in fact have administration panel somewhere
here).
so.. want open files directly /compiled/
, need save ci. should add .htaccess?
tested , working.
the idea verify request_uri
other /system/
or /application/
, see if exists /compiled/
folder.
rewriteengine on rewritebase /somewhere/ rewritecond %{request_uri} ^/somewhere/(system|application)/ [nc] rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_uri} ^/somewhere/(.+)$ [nc] rewritecond %{document_root}/somewhere/compiled/%1 -d [or] rewritecond %{document_root}/somewhere/compiled/%1 -f rewriterule . compiled/%1 [l]
you seem avoid /somewhere/
in htaccess. maybe have avoid in code (depends on server configuration)
Comments
Post a Comment