mod rewrite - .htaccess error 500 on RewriteRule -


this line cause 500 error in apache :

rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qsa,l] 

here htaccess :

<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} ^test\.fr [nc] rewriterule ^(.*)$ http://www.test.fr/$1 [l,r=301] rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qsa,l] </ifmodule> 

any ideas why ?

that's because you're creating infinite loop error.

your rule match , execute on , on.
example:

http://www.test.fr/this/url/is/cool 

will rewritten to

/frontend/artist/artist.php?seo=this/url/is/cool 

which rewritten because rule matches without exception.

and on...

solution

to avoid behaviour, can add simple condition (check if it's existing file or not)

<ifmodule mod_rewrite.c> rewriteengine on  rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.%{http_host}/$1 [l,r=301]  rewritecond %{request_filename} !-f rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qsa,l] </ifmodule> 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -