Welcome Guest, Not a member yet? Register   Sign In
if folder and parameter has same, how to make it to act as argument and not as folder
#1

[eluser]Tejas D[/eluser]
Hello Everybody


I pasted all CI folders in localhost(ie application,system etc).

localhost
-appl
-system
-rest all folders

Also, I created image,css folder in localhost.


I edited default controller in routes, so that my default page is shown.

To access my default page, I just type 'localhost'

A) Now, if I type localhost/image.
It is showing my image folder that is present in localhost.

B) But as stated above I had edited default controller , So on typing localhost/image, why not image
is treated as parameter which I am echoing in my controller function.

Since Both above A and B are correct in their own statement.

As, image word gets conflicted whether we referring image as folder or parameter.


I want image to be treated as parameter.


How to solve this problem?
whether can it be solve by .htaccess or through routes or any other solution is there?




#2

[eluser]rogierb[/eluser]
This is due to your webserver and/or your .htaccess. The default is to treat folders as folders, not as part a parameter or request_uri.

If you want it to be treated as a parameter you need a .htaccess (assuming you run apache) which tells the webserver to ignore /images

Check the .htaccess in the user_guide.

Just a word of warning, using images both as parameter and folder is a bad idea. When should the webserver fetch an image and when not?
#3

[eluser]Tejas D[/eluser]
Hi rogierb

Thanks.

That's True, having same name for both folder and parameter is bad idea.
But It can be achieved using .htaccess as you mentioned. Yes, I am using apache.

I will view user_guide and will try to implement it.




Theme © iAndrew 2016 - Forum software by © MyBB