Проблемы с mod_rewrite и mod_userdir

Я пытаюсь получить локальную копию веб-сайта, на котором работает кто-то другой. Сайт развернут и работает, и я пытаюсь получить версию разработки, настроенную в моем каталоге public_html.

На сайте используется mod_rewrite для перенаправления всего трафика через скрипт шлюза, который выполняет различные шаги инициализации. У меня странная проблема, когда работают ссылки, включая расширение .php , но те, которые не умирают, со следующим исключением:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'redirect:/~george/site/.fiona/core/gateway.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Вот копия файла .htaccess (отредактированная для моей локальной установки)

 RewriteEngine On Options +FollowSymLinks RewriteBase /~george/site/ RewriteCond %{REQUEST_URI} !.fiona/core/gateway.php RewriteRule ^\.fiona/([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$ .fiona/core/gateway.php?group=$1&destination=$2\.php [L,QSA] RewriteCond %{REQUEST_URI} !.fiona/core/gateway.php RewriteRule ^([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$ .fiona/core/gateway.php?group=$1&destination=$2\.php [L,QSA] RewriteCond %{REQUEST_URI} !.fiona/core/gateway.php RewriteRule ^([a-zA-Z0-9_\-]+)(\.php)?$ .fiona/core/gateway.php?destination=$1\.php [L,QSA] 

Вот что я вижу в журналах mod_rewrite

локальный / ~ джордж / сайт / Логин

 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] applying pattern '^\.fiona/([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] applying pattern '^([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] applying pattern '^([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (4) [perdir /home/george/public_html/site/] RewriteCond: input='/~george/site/login.php' pattern='!.fiona/core/gateway.php' => matched 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (2) [perdir /home/george/public_html/site/] rewrite 'login.php' -> '.fiona/core/gateway.php?destination=login.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) split uri=.fiona/core/gateway.php?destination=login.php -> uri=.fiona/core/gateway.php, args=destination=login.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (3) [perdir /home/george/public_html/site/] add per-dir prefix: .fiona/core/gateway.php -> /home/george/public_html/site/.fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (2) [perdir /home/george/public_html/site/] trying to replace prefix /home/george/public_html/site/ with /~george/site/ 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (5) strip matching prefix: /home/george/public_html/site/.fiona/core/gateway.php -> .fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (4) add subst prefix: .fiona/core/gateway.php -> /~george/site/.fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#211168d0/subreq] (1) [perdir /home/george/public_html/site/] internal redirect with /~george/site/.fiona/core/gateway.php [INTERNAL REDIRECT] 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#21103668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^\.fiona/([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'redirect:/~george/site/.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#21103668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'redirect:/~george/site/.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#21103668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'redirect:/~george/site/.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:47:37 --0400] [localhost/sid#20f41ce8][rid#21103668/initial] (1) [perdir /home/george/public_html/site/] pass through redirect:/~george/site/.fiona/core/gateway.php 

локальный / ~ джордж / сайт / login.php

 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^\.fiona/([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/login.php -> login.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] applying pattern '^([a-zA-Z0-9_\-]+)(\.php)?$' to uri 'login.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (4) [perdir /home/george/public_html/site/] RewriteCond: input='/~george/site/login.php' pattern='!.fiona/core/gateway.php' => matched 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (2) [perdir /home/george/public_html/site/] rewrite 'login.php' -> '.fiona/core/gateway.php?destination=login.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) split uri=.fiona/core/gateway.php?destination=login.php -> uri=.fiona/core/gateway.php, args=destination=login.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (3) [perdir /home/george/public_html/site/] add per-dir prefix: .fiona/core/gateway.php -> /home/george/public_html/site/.fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (2) [perdir /home/george/public_html/site/] trying to replace prefix /home/george/public_html/site/ with /~george/site/ 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (5) strip matching prefix: /home/george/public_html/site/.fiona/core/gateway.php -> .fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (4) add subst prefix: .fiona/core/gateway.php -> /~george/site/.fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224bf668/initial] (1) [perdir /home/george/public_html/site/] internal redirect with /~george/site/.fiona/core/gateway.php [INTERNAL REDIRECT] 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/.fiona/core/gateway.php -> .fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] applying pattern '^\.fiona/([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri '.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (4) [perdir /home/george/public_html/site/] RewriteCond: input='/~george/site/.fiona/core/gateway.php' pattern='!.fiona/core/gateway.php' => not-matched 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/.fiona/core/gateway.php -> .fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] applying pattern '^([az]+)/([a-zA-Z0-9_\-]+)(\.php)?$' to uri '.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] strip per-dir prefix: /home/george/public_html/site/.fiona/core/gateway.php -> .fiona/core/gateway.php 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (3) [perdir /home/george/public_html/site/] applying pattern '^([a-zA-Z0-9_\-]+)(\.php)?$' to uri '.fiona/core/gateway.php' 127.0.0.1 - - [05/Oct/2011:08:58:18 --0400] [localhost/sid#222fdce8][rid#224c97b8/initial/redir#1] (1) [perdir /home/george/public_html/site/] pass through /home/george/public_html/site/.fiona/core/gateway.php 

Ссылки без расширения .php похоже, делают первоначальный переадресацию успешно, однако по какой-то причине они, похоже, не могут перенаправить к абсолютному пути.

Я никоим образом не специалист по mod_rewrite, поэтому здесь могут быть и другие проблемы. Любые идеи были бы замечательными.

EDIT Основываясь на ответе Мариуса, я считаю, что я сузил это до проблемы с mod_userdir в сочетании с mod_rewrite. Перемещение сайта в / var / www решает проблему. Я все равно хотел бы, чтобы это работало в моем каталоге public_html.

EDIT Marius привел меня ближе к решению в разрешенных сайтах. Оказывается, проблема заключалась в том, что MultiViews (позволяет apache интерпретировать индекс как index.php) не был включен для пользовательских каталогов. Добавление на мои сайты по умолчанию, включенные (/ etc / apache2 / sites-enabled / 000-default), разрешило проблему с расширениями .php, но отключает mod_rewrite.

 &ltDirectory /home/*/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> 

Включены все мои сайты

 &ltVirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www &ltDirectory /> Options FollowSymLinks AllowOverride None </Directory> &ltDirectory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> &ltDirectory /home/*/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ &ltDirectory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" &ltDirectory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>