Jump to content


Photo

Hide Php Extenstion From Webpage


  • Please log in to reply
6 replies to this topic

#1 believeinsharing

believeinsharing

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 15 November 2012 - 11:20 AM

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

#2 SocialCloud

SocialCloud

    Advanced Member

  • Members
  • PipPipPip
  • 617 posts

Posted 15 November 2012 - 11:22 AM

Look into .htaccess

#3 Manixat

Manixat

    Advanced Member

  • Members
  • PipPipPip
  • 166 posts

Posted 15 November 2012 - 11:23 AM

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, 15 November 2012 - 11:26 AM.


#4 believeinsharing

believeinsharing

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 15 November 2012 - 11:28 AM

@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

#5 SocialCloud

SocialCloud

    Advanced Member

  • Members
  • PipPipPip
  • 617 posts

Posted 15 November 2012 - 11:29 AM

Manixat's example should work.

#6 believeinsharing

believeinsharing

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 15 November 2012 - 11:36 AM

@ Manixat:

Thx for reply I tried your code bt its not working

#7 believeinsharing

believeinsharing

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 15 November 2012 - 08:29 PM

any other option




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com