Hide .php extension from url?

Discussion in 'Programming' started by Noah Wilson, Mar 13, 2013.

  1. #1
    Hello Guys,
    Please suggest me how can be i hide .php extension from my website url by using .htaccess file.
    Thanks for any suggestion.
     
    Noah Wilson, Mar 13, 2013 IP
  2. markjayswal

    markjayswal Greenhorn

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #2
    USE THIS CODE:

    RewriteEngine On
    # turn on the mod_rewrite engine

    RewriteCond %{REQUEST_FILENAME}.php -f
    # IF the request filename with .php extension is a file which exists
    RewriteCond %{REQUEST_URI} !/$
    # AND the request is not for a directory
    RewriteRule (.*) $1\.php [L]
    # redirect to the php script with the requested filename
     
    markjayswal, Mar 13, 2013 IP