Jump to content


Photo

Hide File Extensions


  • Please log in to reply
4 replies to this topic

#1 ImJustBrndn

ImJustBrndn
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 26 October 2006 - 12:51 AM

I'm curious as to how to hide file extensions in the browser's address bar. For example

http://www.threadless.com/submit
http://www.threadless.com/submit.php

both take you to the same file, but if you go to the one without the .php, the .php never shows up. Can someone please tell me how to do this, I've searched and not been able to find it out. Thanks in advance guys, you rock.

Brandon

#2 fert

fert
  • Members
  • PipPipPip
  • Advanced Member
  • 1,114 posts

Posted 26 October 2006 - 01:07 AM

this is an Apache thing

Si hoc legere scis nimium eruditionis habes
Gentoo Linux 2007.0 Firefox 2

#3 php_joe

php_joe
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 26 October 2006 - 04:43 PM

I'm curious as to how to hide file extensions in the browser's address bar. For example

http://www.threadless.com/submit
http://www.threadless.com/submit.php

both take you to the same file, but if you go to the one without the .php, the .php never shows up. Can someone please tell me how to do this, I've searched and not been able to find it out. Thanks in advance guys, you rock.

Brandon


For http://www.threadless.com/submit you just make a folder named "submit" and then name the file index.php instead of "submit.php"

Joe
[url=http://darkswordsguide.com][/url]

#4 wildteen88

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

Posted 26 October 2006 - 06:16 PM

I'm curious as to how to hide file extensions in the browser's address bar. For example

http://www.threadless.com/submit
http://www.threadless.com/submit.php

both take you to the same file, but if you go to the one without the .php, the .php never shows up. Can someone please tell me how to do this, I've searched and not been able to find it out. Thanks in advance guys, you rock.

Brandon


For http://www.threadless.com/submit you just make a folder named "submit" and then name the file index.php instead of "submit.php"

Joe

Thats a long winded way of doing it! The best option is to use mod_rewrite!:
RewriteRule ^submit$ submit.php
Then when ever you go to http://www.threadless.com/submit it'll call submit.php

Another option is to tell Apache to parse extensionless files with PHP instead, which isnt recommended. mod_rewrite is the best way to go about it.

#5 ImJustBrndn

ImJustBrndn
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 26 October 2006 - 10:16 PM

Thanks a lot guys you were all helpful I thought this was a php issue, but it's an apache issue. I used wildteen's approach via the .htaccess file. Thanks again.

Brandon




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users