• 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,286

    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 Uninstall ‘Get forms online’ Malware?
    • How to turn on phone without power button?
    • How to get and save user input during installation using Advanced Installer?
    • How to protect your .net software code with ILProtector?
    • How to fix failed download in Youtube to Mp3 Pro?
    • How to Fix iPhone White Screen of Death?
    • How to gain space on your Android device?
    • How to cancel a frozen app download on your Android device?
    • How to fix WhatsApp?
    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