apache - htaccess rewrite rule doesnt work in mobile browser -
ive been trying make mobile version of site , redirecting users htaccess file.
my site uses rewrite rules before clean urls, works great. when try exact same rule redirect mobile.php instead of index.php, 500 internal server error.
here code:
rewriteengine on rewritecond %{http_user_agent} #detect mobile browsers here... rewriterule ^([^/]*)[/]*([^/]*)$ /mobile.php?r=$1&id=$2 [l] rewritecond %{script_filename} !-f rewritecond %{script_filename} !-d rewriterule ^([^/]*)[/]*([^/]*)$ /index.php?r=$1&id=$2 [l] can see problem?
yes -- line post invalid few reasons:
rewritecond %{http_user_agent} #detect mobile browsers here... comment
#detect mobile browsers here...can first non-empty character in line -- comment cannot start in middle of line.because of #1, line incomplete -- should have "condition pattern" part, missing (you have comment instead). see the docs full/correct syntax
you may enter rewrite loop in rule (a lot of people forgetting after mod_rewrite rewrite, goes iteration, , if not insert proper condition (rewritecond) may loop forever -- apache break after reaches limit, point remains).
Comments
Post a Comment