Jump to content


Photo

hiding .php extension


  • Please log in to reply
9 replies to this topic

#1 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 October 2006 - 09:06 AM

Hi i don't have access to modify any apache settings on the server.  I want to hide the .php extension and i'm  trying out renaming the file without an extension and then including ForceType application/x-httpd-php in .htaccess Is this the best method and what are the down sides before i get stuck into my whole site!  Is there alternative if this is not a prefered option?

Thanks

R

#2 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 October 2006 - 09:09 AM

Looks like this method does not work in firefox should that be right?

Thanks

R

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 20 October 2006 - 09:20 AM

You would want mod rewrite. here is a nice tutorial http://www.yourhtmls...lrewriting.html

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 October 2006 - 09:29 AM

Hi thanks i've tried using mod_rewrite already and i'm getting an 500 internal server error?  my site is in a subdirectory does this make a difference?  I've looked on php.ini and it look like it there?

Thanks

R

#5 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 20 October 2006 - 10:00 AM

It shouldn't make a difference. I have never had that issue before... Can you please post a copy of the .htaccess that you tried with. You may have made an error when writting it.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#6 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 October 2006 - 10:05 AM

Hi, i was trying this example
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]

which i don't think is really what i want but i get the 500 error right away no pages from the subdirectory will load.

Thanks

Ross

#7 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 20 October 2006 - 10:11 AM

Put this in your .htaccess file:
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html


#8 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 20 October 2006 - 10:14 AM

Here is a very detailed mod rewrite reference.. http://forums.devshe...sts-267522.html

replace the * with a +

like this

RewriteRule ^(.+)\.html$ $1.php

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#9 rossh

rossh
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 20 October 2006 - 12:10 PM

Hi thanks for getting back to me.  I've tried both:-

Options +FollowSymlinks
RewriteEngine on
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

and

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.html$ $1.php

and both give me a 500 error?

Thanks again

R

#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 October 2006 - 06:57 PM

Look in your servers error log. The error log will give you a reason why you are getting the 500 Internal Error message.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users