.htaccess - Using htaccess to remove sub-directories from URL in CodeIgniter -
my codeigniter project placed inside sub-folders , want hide 2 sub-folders .htaccess.
everything working fine current url looks this:
example.com/folder1/folder2/ci_project/class/function/$id i want be:
example.com/class/function/$id now, using simple .htaccess code in order remove index.php url:
options +followsymlinks rewriteengine on # send request via index.php rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] any ideas?
when use following code in htaccess file inside folder1/folder2/ci_project, hide sub directories error "object not found"
rewritecond %{request_uri} !^/folder1/folder2/ci_project/
rewriterule ^(.*)$ /folder1/folder2/ci_project/index.php/$1 [l]
move current .htaccess file ci_project/ root of domain, , replace these code inside it:
<ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritecond $1 !^(robots\.txt|favicon\.ico|public) rewriterule ^(.*)$ /folder1/folder2/ci_project/index.php/$1 [l] </ifmodule> in case, should place public files in folder public @ root of domain.
you should add other folders (like public) rewritecond if don’t want them treated rewriterule.
if multiple application exist in same domain, might want consider option:
<ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /folder1/folder2/ci_project/index.php/$1 [l] </ifmodule>
Comments
Post a Comment