Welcome Guest, Not a member yet? Register   Sign In
Problem htaccess + rewrite
#1

[eluser]Unknown[/eluser]
Hi,

I'm having a problem with a RewriteRule in my htacces.

First, here is my file :

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    #Options +FollowSymLinks
    RewriteBase /~user/my_dir/
    
    #Removes access to the system folder by users.
    RewriteCond %{REQUEST_URI} ^sys.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    #This snippet prevents user access to the application folder
    RewriteCond %{REQUEST_URI} ^app.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #HERE IS THE PROBLEM
    RewriteRule (.*)\.html /~user/my_dir/index.php/html/page/$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.
    ErrorDocument 404 /index.php
</IfModule>

My problem is this RewriteRule :

Code:
RewriteRule (.*)\.html /~user/my_dir/index.php/html/page/$1 [L]

Note that the following RewriteRule also don't work :

Code:
RewriteRule test\.html /~user/my_dir/index.php/html/page/test [L]

With a [R] mode instead of a [L] mode, the redirection is working well.

Code:
RewriteRule (.*)\.html /~user/my_dir/index.php/html/page/$1 [R]

Also, I've tried each mode in the config.php uri_protocol properties.

In the [L] case, CI rewrite me to a 404 Page Not Found. Of course, the file html exists, which has a function named page with an argument, like this :

Code:
class Html extends CI_Controller {
    
    //page emploi-handicap-fonction.cfm
    public function index() {
        var_dump("index");
    }
    
    //page emploi-handicap-fonction.cfm
    public function page($param = null) {
        var_dump($param);
    }

Any idea ?

Thanks in advance for your help,

Fabrice




Theme © iAndrew 2016 - Forum software by © MyBB