• Windows Mac Android Linux
    Tools News Blog How To
  • Articles (current)
  • Submit Software
    • Register Login

    How to hide .php extension from url with .htaceess?

    • Admin
    • 2016-08-07 14:56:28
    • 1,857

    There are many reasons that we want/need to hide extensions from the url. One of the major benefits of hiding extension from url is that if we are going to change hosting from windows to linux or vice versa we can still have same url structure and will not lose seo rankings.

    Here is a sample .htaccess code that we will need to do this.

    If it's just a simple page

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^page/?$ page.php [L]

    This will redirect /page.php to page

    If page accepts parameters

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^page/([^/]+)/([^/]+)/?$ page.php?prm=$1&prm=$2 [L]

    With this you can write page.php?prm=value1&prm=value2 as page/value1/value2


    Most Read
    • How to uninstall idm from windows 10?
    • How to Convert JPG to ICO
    • How to Convert JPG to SVG
    • How to Convert PNG to JPG
    • How to Convert PNG to ICO
    • How to Convert PNG to SVG
    • How to Convert TIFF to JPG
    • How to Convert SVG to JPG
    • How to Convert NEF to JPG
    • How to Convert JPG to JPEG
    Random Article Write An Article
    Standalone Installer

    Standalone Installer © 2022

    Our Projects
    • Free PDF Solutions
    • Media Freeware
    • Free Picture Solutions
    • Tiny Mini Tools
    • PDF Tools
    Standalone
    • Online Tools
    • News
    • Blog
    • How to
    Legal
    • Privacy Policy
    • Contact
    • Report