Jump to content

Hide Php Extenstion From Webpage


believeinsharing

Recommended Posts

Hi

I am developing one website its in PHP and I am using Eclipse

When I click on any page link its shows "www............com/home.php or www............com/blog.php " in address bar where home and blog are my php pages

I wanted to hide those php extenstions and would like to see only "www............com/home or www............com/blog"

Is it possible and if yes how?

Thx in advance for help

Link to comment
Share on other sites

I'm not entirely sure this method is safe but it can be accomplished by having a .htaccess file in your root folder which states the following:

 

 

RewriteEngine On

RewriteCond %{REQUTEST_FILENAME} !-d
RewriteCond %{REQUTEST_FILENAME} !-f
RewriteCond %{REQUTEST_FILENAME} !-l

RewriteRule ^home$ home.php [L,NS]
RewriteRule ^blog$ blog.php [L,NS]

 

 

Again, I am not fully aware of how this works or if it's safe or not, just trying to help out

Edited by Manixat
Link to comment
Share on other sites

@SocialCloud:

thx for ur quick responce I did created .htaccess file and its has following code

 

RewriteEngine on

RewriteCond %(REQUEST_FILENAME) !-d

RewriteCond %(REQUEST_FILENAME)\.php -f

RewriteRule ^(.*)$ $1.php

 

I got this form google.. I have .htaccess file in my page folder where i have all my php pages

 

Directory of my website is:

MainFolder thn it has subfolders for Images, Pages, Styles, and Lib

 

Thx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.