• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess - Filenames in URI

#1
[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

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

#3
[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

#4
[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']?

#5
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.