php - Remove file extention from urls -


i have urls in website this..

http://www.mydomain.com/about.php http://www.mydomain.com/contact.php http://www.mydomain.com/signup.php http://www.mydomain.com/testimonials.php ...... , more  

now trying convert above urls user friendly url

http://www.mydomain.com/about http://www.mydomain.com/contact http://www.mydomain.com/signup http://www.mydomain.com/testimonials 

this code in .htaccess file tried far. doesn't work.

# add trailing slash url   rewritecond %{request_filename} !-f   rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/|#(.*))$   rewriterule ^(.*)$ $1/ [r=301,l]  # remove .php-extension url   rewritecond %{request_filename} !-d   rewritecond %{request_filename}\.php -f   rewriterule ^([^\.]+)/$ $1.php  

anyone can me remove .php etension urls?? thank you.

get rid of conditions using , instead use below 2 lines in htaccess file

rewriteengine on # turn on rewriting engine rewriterule   ^whatever/?$   whatever.php  [nc] 

this work if user types forward slash after name or not

if want make them dynamic, here's tutorial on that


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -