.htaccess - How to add dot in htaccess rewrite rule regex? -
i want create url structure dir view (example.com/dir1/dir2/file) using htaccess mod rewrite as
rewriteengine on rewritebase / rewriterule ^/?([a-za-z0-9\-=&_@/]+)/?$ get.php?u=$1 [qsa,l] the code above works fine except if try add dot like
rewriteengine on rewritebase / rewriterule ^/?([a-za-z0-9\-=&_@/.]+)/?$ get.php?u=$1 [qsa,l] the .htaccess breaks. "internal server error"
the problem if add dot in pattern pattern matches target url get.php , rewrites get.php get.php on second rewrite cycle. results in infinite loop/rewrite loop error.
you need rewritecond prevent :
rewriteengine on rewritebase / rewritecond %{request_uri} !^/get.php rewriterule ^/?([a-za-z0-9\-=&_@/.]+)/?$ get.php?u=$1 [qsa,l]
Comments
Post a Comment