Проблемы с перезаписью URL-адресов при включенном fcgid

Проблемы с перезаписью URL-адресов при включенном fcgid

Сначала немного информации о моем сервере:

Apache2Версия: 2.4 Модули: php5: неполноценный; переписать: включено; суексек: включено; fcgid: включено;

PHP-кодВерсия: 5.3.3

В настоящее время я создаю веб-сайт с помощью CodeIgniter и хотел бы переписать URL-адреса, чтобы «скрыть» index.php от браузера.

Я уже попробовал эти 2 решения, но они не сработали:http://takeitoffroad.blogspot.ch/2008/08/codeigniter-issues-with-htaccess-to.html

Мой файл .htaccess в настоящее время выглядит так:

Редактировать: Я заставил это работать, если я вставляю его в файл конфигурации моего vHost, но если я использую его в .htaccess, он не делает то, что должен... активированная трассировка, журнал ниже:

<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]

Если я проверю последнюю строку (внутреннее перенаправление), то это будет точно такая же строка, как если бы я перешел на /index.php/main/forgot напрямую, тогда это сработает... Я бы сказал, что это как-то связано с FCGID

Буду рад любому возможному решению. Если вам нужна дополнительная информация, просто напишите комментарий, и я ее добавлю.

Спасибо

Ксавьер

решение1

Хорошо, решение найдено. Я не знаю точно, почему, но добавление вопросительного знака перед слешем в index.php/$1 теперь работает нормально... вчера не работало O_o

<IfModule mod_rewrite.c>
    RewriteEngine On

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

Может ли кто-нибудь объяснить мне, почему он там должен быть?

Связанный контент