Forum Moderators: phranque
I want to rewrite [midominio.com...] to [midominio.com...]
.htaccess
RewriteRule ^(.*)$ index.php?id=$1 The result of id=index.php instead id=david
Its Posible? Any Ideas?
However to rewrite [midominio.com...]
RewriteRule ^(.*)/$ index.php?id=$1 The result is ok id=david
Welcome to WebmasterWorld!
It looks like your Rule is recursive. That is, it will rewrite /david to /index.php?id=david, and then it will rewrite /index.php?id=davis to index.php?id=index.php because there is nothing to stop this from happening. This is because the URL-path "index.php" matches the (.*) pattern.
To back up: Whenever a rewrite completes in .htaccess, control is passed back to httpd.conf and then through any .htaccess file(s) in the new URL-path so that access restrictions or rewrites that apply to the new URL-path can be applied. In this case, this behaviour will make your .htaccess file appear to call itself. Because there is nothing in your rule to prevent a second rewrite, your rule will loop.
Try:
RewriteRule $1 !^index\.php$
RewriteRule ^(.*)/?$ index.php?id=$1
Jim