.htaccess - Rewrite rule in php -


i have url

http://example.com/test.php?pid=105701 

i need remove .php in url.i have tried lot url has going this

http://example.com/test/?pid=105701 

in above url go directory structure. not able access test.php file

this .htaccess file

rewriteengine on rewritecond %{request_filename}.php -f rewritecond %{request_uri} !/$ rewriterule ^(.*)$ $1\.php 

help me on in advance

you have make corrections, should exclude cases contains .php also:

rewriteengine on  # rewrite filename.php rewriterule ^([^.?]+)$ %{request_uri}.php [l]  # return 404 if original request filename.php rewritecond %{the_request} "^[^ ]* .*?\.php[? ].*$" rewriterule .* - [l,r=404] 

Comments

Popular posts from this blog

ios - Is 'init' forbidden as *part* of a variable name? -

javascript - Why Selenium can't find an element that is graphically visible -

angular - Angular2 Router: Cannot find primary outlet to load 'HomeComponent' -