saikiran
saikiran

Reputation: 2435

Routing Conflict in Codeigniter application with other assets in root folder

Hi I have Codeigniter Web App.

I am Facing conflict between my route and an asset(Image or some file) with exact name as my route name.

My asset is opening in browser when i am trying to access my route. I know the solution can be achieved with htaccess but i simply not getting it.

Any help would be appreciated.

Check my Folder Structure Below:

Root
 - application
 - system
 - assets
   event.png
   list.html

.htaccess:

RewriteEngine On
Options -Indexes 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R]

My route is www.example.com/event/event-name

I am facing issue here.

Upvotes: 1

Views: 140

Answers (1)

delboy1978uk
delboy1978uk

Reputation: 12355

Find and replace usages of event.png, and rename it!

OR, reconfigure your route. You can use regex to ensure your route doesn't accept a .png in it. See here https://www.codeigniter.com/userguide3/general/routing.html

Upvotes: 1

Related Questions