CodeIgniter Forums
.htaccess - Filenames in URI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: .htaccess - Filenames in URI (/thread-12086.html)



.htaccess - Filenames in URI - El Forum - 10-05-2008

[eluser]Lockzi[/eluser]
Yea, you've guessed it!
This is another .htaccess help thread I'm afraid.

This is what my current .htaccess looks like
Code:
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript application/javascript text/css

and it works just fine for me, except for with my filemanager.
When I try to do this
Code:
http://127.0.0.1/file_management/remove/images/Kass.jpg
it rewrites the url for codeigniter ( $this->uri->uri_string() ) to
Code:
http://127.0.0.1/file_management/remove/images/Kass_jpg


Been googling, but all I can find is how to REMOVE the dot instead of BRING BACK which is what people normally want.

Cheers,
Lockzi


.htaccess - Filenames in URI - El Forum - 10-05-2008

[eluser]Pascal Kriete[/eluser]
Where is this rewrite happening? Can you just run str_replace in your script?


.htaccess - Filenames in URI - El Forum - 10-05-2008

[eluser]Lockzi[/eluser]
I just removed .htaccess and the url still got an underscore in it, maybe it is the security filter in CI?

I where using str_replace to fix this but wanted to find the real problem, where ever it's located. Smile


.htaccess - Filenames in URI - El Forum - 10-05-2008

[eluser]Pascal Kriete[/eluser]
Hmm, just ran a quick test to double check. It's not CI.

Test controller:
Code:
function home($param)
{
    echo $this->uri->uri_string(),'<br />';
    die($param);
}
Prints:
[pre]
/test/home/kass.jpg
kass.jpg
[/pre]

Do you have any router changes that might do this? What happens if you read out $_SERVER['PATH_INFO']?


.htaccess - Filenames in URI - El Forum - 10-06-2008

[eluser]Lockzi[/eluser]
[quote author="inparo" date="1223266214"]Hmm, just ran a quick test to double check. It's not CI.

Test controller:
Code:
function home($param)
{
    echo $this->uri->uri_string(),'<br />';
    die($param);
}
Prints:
[pre]
/test/home/kass.jpg
kass.jpg
[/pre]

Do you have any router changes that might do this? What happens if you read out $_SERVER['PATH_INFO']?[/quote]

Code:
function view($param, $param2)
    {
        //Pre
        $this->function = "view";
        echo $this->uri->uri_string()."<br />";
        die($param2);

returns the following

Code:
/file_management/view/home/kass_jpg
kass_jpg


Code:
echo $_SERVER['PATH_INFO'];

throws an error...
Quote:Severity: Notice

Message: Undefined index: PATH_INFO

Filename: controllers/file_management.php

Line Number: 22

I haven't touched the routes... Feels like a needle in a haystack! It's driving me mad only because I can't find it.

I have solved it by using post to delete files since URL's are stored in the browser and the URL to a deleted file is not good to be stored Smile

Still curiously mad about it though