1

I have a successful implementation of htaccess to remove index.php in codeigniter. Which meant that I can access any controller via domain.com/controllername.

However, I realized that with this implementation I cannot access sub-directory within the server via the URL. Please advice if there is a working solution to resolve such issue.

Thank you

The htaccess which I am using now is as follows

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^(index\.php|update\.php|administrator\.php|assets|admin|robots\.txt|favicon\.ico)
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule> 

<FilesMatch ".(ico|jpg|jpeg|png|gif)$">
ExpiresActive On
ExpiresDefault "access plus 1 month"
</FilesMatch>
2
  • Not sure how to help you without seeing what your config looks like... Commented Aug 24, 2014 at 5:38
  • Terribly sorry, updated my question Commented Aug 26, 2014 at 4:43

2 Answers 2

1

Mark this may be the probable solution to your issue where you are unable to access the sub folders of the system.

# if a directory or a file exists, use it directly
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php #Here you write the line which will overwrite the index.php and will move the control to your controller.

The comments in the code are itself self speaking. For more exact answer post your exact htacess you are using. Hope that helps you.

Sign up to request clarification or add additional context in comments.

Comments

0

if your pointing out another site inside your domain aka sub-folder. Edit your .htaccess like this :

RewriteBase /domain.com/sub-folder/

or

RewriteBase /sub-folder/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.