mod rewrite - Having trouble using .htaccess for hiding the .php extension -
mod rewrite - Having trouble using .htaccess for hiding the .php extension -
i'm having problem using .htaccess. content of .htaccess file
rewriteengine on rewritecond %{request_filename}!-d rewritecond %{request_filename}!-f rewriterule ^([^.]+)\.php$ $1 [l]
i opened text file, pasted these lines , saved .htaccess showing .htaccess before right clicked .htaccess file , changed "open notepad". guess shouldn't create difference showing blank name.
the main problem when open localhost on browser through wamp, folder i've kept .htaccess file, isn't visible or if access shows internal server error.now, if remove .htaccess file there, shows in localhost directory , doesn't show error when seek open it.
if you're getting 500 internal server error, .htaccess file beingness read. see, may missing spaces before !
:
rewriteengine on rewritecond %{request_filename} !-d #-----------------------------^^ rewritecond %{request_filename} !-f #-----------------------------^^ rewriterule ^([^.]+)\.php$ $1 [l]
but if want users not see .php extension, rewriterule
backwards. first part should not contain .php:
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f # input url has no php, internally served .php rewriterule ^([^.]+)$ $1.php [l]
.htaccess mod-rewrite url-rewriting
Comments
Post a Comment