Убедитесь, что правило перезаписи в вашем .htaccess
применяется несколько раз:
0: http://domain.com/data/user/foobar
1: /data/user/foobar -> /data/user/index.php?id=foobar
2: /data/user/index.php?id=foobar -> /data/user/index.php?id=index.php
Поэтому оно всегда заменяет ваш параметр id
на index.php
.
. Вам нужнов записать условие , что если index.php
уже запрошено, оно не будет переписано, например, путем проверки, существует ли файл:
RewriteEngine On
RewriteBase /data
# the following condition applies to the next rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^user/(.*)$ user/index.php?id=$