Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access folder via browser if codeigniter project exists?

I have codeigniter project lets say example.com. In my public_html folder on my server, i created a folder called test and i want to be able to access some file via the web using example.com/test/somefile.php

Since i also have a codeigniter project in the same public_html directory, i always get a codeigniter page not found error when i try example.com/test/somefile.php.

How can i basically tell my server or codeigniter project that the folder "test" is not part of the codeigniter app?

like image 389
Catfish Avatar asked Jan 28 '26 12:01

Catfish


1 Answers

In your .htaccess at the root of public_html, you probably have something like this for routing everything through index.php:

Example taken from the CI user guide: http://codeigniter.com/user_guide/general/urls.html

RewriteEngine on
# If the path doesn't start with one of these...
RewriteCond $1 !^(index\.php|images|robots\.txt)
# ...send the request to index.php/REQUEST
RewriteRule ^(.*)$ /index.php/$1 [L]

Just add "test" to the pipe delimited group, or whatever you need to do to allow access to the directory with your configuration:

RewriteCond $1 !^(index\.php|test|images|robots\.txt)
#                            ^^^^

Without this CI requires index.php in the URL - there's no way to actually have your Codeigniter app itself redirect, rewrite URLs, or block access to the /test directory, it's generally all done through an .htaccess file.

like image 196
Wesley Murch Avatar answered Jan 31 '26 03:01

Wesley Murch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!