Jump to content

Hide File Extensions


ImJustBrndn

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/25115-hide-file-extensions/
Share on other sites

[quote author=ImJustBrndn link=topic=112733.msg457739#msg457739 date=1161823879]
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
[/quote]

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

Joe
Link to comment
https://forums.phpfreaks.com/topic/25115-hide-file-extensions/#findComment-114872
Share on other sites

[quote author=php_joe link=topic=112733.msg458066#msg458066 date=1161880995]
[quote author=ImJustBrndn link=topic=112733.msg457739#msg457739 date=1161823879]
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
[/quote]

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

Joe
[/quote]
Thats a long winded way of doing it! The best option is to use mod_rewrite!:
[code]RewriteRule ^submit$ submit.php[/code]
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.
Link to comment
https://forums.phpfreaks.com/topic/25115-hide-file-extensions/#findComment-114967
Share on other sites

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.