0

When I write in .htaccess this mod_rewrite

 RewriteEngine on
 RewriteRule ^(.*)\.my_extension$ $1.php

and open url: site.com/index.my_extension this wroks fine, opened index.php

But when I am trying mod_rewrite like this:

 RewriteEngine on
 RewriteRule ^(.*)$ index.php?url=$1

this gives me Internal Server Error.

Why this happened? what is reason?

MadHatter
  • 80,590
  • You need to add more information. Have you enabled rewrite logging? Are the two rewrite rules in the same config file? It can be possible that you could have a redirect/rewrite loop, as you are catching all then redirecting to index.php?url=foo/bar/index.php?url=foo/bar/index.php, etc. – Danie Apr 25 '13 at 10:53
  • Have you enabled rewrite logging? --- if rewrite logging not enabled, then how firts rewriterule works?

  • Are the two rewrite rules in the same config file? --- no, just one RewriteRule is in .htaccess file.

  • It can be possible that you could have a redirect/rewrite loop --- In other servers, catching all then redirecting to index.php works, and here why must happened redirect/rewrite loop? reason of this may be some option?

  • – Oto Shavadze Apr 25 '13 at 11:13
  • read this: http://serverfault.com/questions/214512/everything-you-ever-wanted-to-know-about-mod-rewrite-rules-but-were-afraid-to-as – HVNSweeting Apr 25 '13 at 11:19