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
https://forums.phpfreaks.com/topic/270738-hide-php-extenstion-from-webpage/
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

@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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.