0

First some information about my server:

Apache2 Version: 2.4 Modules: php5 : disabled; rewrite : enabled; suexec : enabled; fcgid : enabled;

Php Version: 5.3.3

I am currently creating a website using CodeIgniter, i would like to rewrite my URL's to 'hide' the index.php from the browser

I already tried these 2 solutions here but it didn't work: http://takeitoffroad.blogspot.ch/2008/08/codeigniter-issues-with-htaccess-to.html

My .htaccess file currently looks like this:

Edit: I made this one work, if I put it in to my conf file of my vHost, but if i use it in .htaccess it doesn't do what it should... activated trace, log below:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>


[Wed May 22 09:42:18.665868 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] add path info postfix: /var/customers/webs/cust/sdom/domain/main -> /var/customers/webs/cust/sdom/domain/main/forgot
[Wed May 22 09:42:18.665898 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] strip per-dir prefix: /var/customers/webs/cust/sdom/domain/main/forgot -> main/forgot
[Wed May 22 09:42:18.665905 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] applying pattern '^(.*)$' to uri 'main/forgot'
[Wed May 22 09:42:18.665924 2013] [rewrite:trace4] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] RewriteCond: input='/var/customers/webs/cust/sdom/domain/main' pattern='!-f' => matched
[Wed May 22 09:42:18.665941 2013] [rewrite:trace4] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] RewriteCond: input='/var/customers/webs/cust/sdom/domain/main' pattern='!-d' => matched
[Wed May 22 09:42:18.665949 2013] [rewrite:trace2] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] rewrite 'main/forgot' -> 'index.php/main/forgot'
[Wed May 22 09:42:18.665972 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] add per-dir prefix: index.php/main/forgot -> /var/customers/webs/cust/sdom/domain/index.php/main/forgot
[Wed May 22 09:42:18.665982 2013] [rewrite:trace2] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] strip document_root prefix: /var/customers/webs/cust/sdom/domain/index.php/main/forgot -> /index.php/main/forgot
[Wed May 22 09:42:18.665988 2013] [rewrite:trace1] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1916d60/initial] [perdir /var/customers/webs/cust/sdom/domain/] internal redirect with /index.php/main/forgot [INTERNAL REDIRECT]
[Wed May 22 09:42:18.666041 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1926cc0/initial/redir#1] [perdir /var/customers/webs/cust/sdom/domain/] add path info postfix: /var/customers/webs/cust/sdom/domain/index.php -> /var/customers/webs/cust/sdom/domain/index.php/main/forgot
[Wed May 22 09:42:18.666052 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1926cc0/initial/redir#1] [perdir /var/customers/webs/cust/sdom/domain/] strip per-dir prefix: /var/customers/webs/cust/sdom/domain/index.php/main/forgot -> index.php/main/forgot
[Wed May 22 09:42:18.666058 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1926cc0/initial/redir#1] [perdir /var/customers/webs/cust/sdom/domain/] applying pattern '^(.*)$' to uri 'index.php/main/forgot'
[Wed May 22 09:42:18.666069 2013] [rewrite:trace4] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1926cc0/initial/redir#1] [perdir /var/customers/webs/cust/sdom/domain/] RewriteCond: input='/var/customers/webs/cust/sdom/domain/index.php' pattern='!-f' => not-matched
[Wed May 22 09:42:18.666076 2013] [rewrite:trace1] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c1926cc0/initial/redir#1] [perdir /var/customers/webs/cust/sdom/domain/] pass through /var/customers/webs/cust/sdom/domain/index.php
[Wed May 22 09:42:18.666130 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] add path info postfix: /var/customers/webs/cust/sdom/domain/main -> /var/customers/webs/cust/sdom/domain/main/forgot
[Wed May 22 09:42:18.666149 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] strip per-dir prefix: /var/customers/webs/cust/sdom/domain/main/forgot -> main/forgot
[Wed May 22 09:42:18.666156 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] applying pattern '^(.*)$' to uri 'main/forgot'
[Wed May 22 09:42:18.666167 2013] [rewrite:trace4] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] RewriteCond: input='/var/customers/webs/cust/sdom/domain/main' pattern='!-f' => matched
[Wed May 22 09:42:18.666184 2013] [rewrite:trace4] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] RewriteCond: input='/var/customers/webs/cust/sdom/domain/main' pattern='!-d' => matched
[Wed May 22 09:42:18.666191 2013] [rewrite:trace2] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] rewrite 'main/forgot' -> 'index.php/main/forgot'
[Wed May 22 09:42:18.666198 2013] [rewrite:trace3] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] add per-dir prefix: index.php/main/forgot -> /var/customers/webs/cust/sdom/domain/index.php/main/forgot
[Wed May 22 09:42:18.666206 2013] [rewrite:trace2] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] strip document_root prefix: /var/customers/webs/cust/sdom/domain/index.php/main/forgot -> /index.php/main/forgot
[Wed May 22 09:42:18.666212 2013] [rewrite:trace1] [pid 24571] mod_rewrite.c(466): [client 193.134.254.25:61594] 193.134.254.25 - - [domain.example.com/sid#7fc8c1882480][rid#7fc8c191cd90/subreq] [perdir /var/customers/webs/cust/sdom/domain/] internal redirect with /index.php/main/forgot [INTERNAL REDIRECT]

If I check the last line (internal redirect), it is exactly the same line as if I would browse to /index.php/main/forgot directly, then it would work... I'd say it must have sth to do with FCGID

I would be glad for any possible solution. If you want more information, just post a comment and I'll add it

Thanks

Xavjer

1 Answer 1

0

Okay found a solution. i don't know exactly why, but adding a questionmark before the slash in index.php/$1 is working fine now... didn't work yesterday tough O_o

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

Could anyone explain to my why it has to be there?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .