Kitty Posted December 25, 2006 Share Posted December 25, 2006 I don't really know what it's called, but I see it alot on other sites. How do I get rid of the .php extension? Like if I have a page mysite.com/page.php it would be mysite.com/page/Thanks! Link to comment https://forums.phpfreaks.com/topic/31820-how-to-change-pagephp-to-page/ Share on other sites More sharing options...
fert Posted December 25, 2006 Share Posted December 25, 2006 you create a directory and put only page.php in it or you could use .htaccess Link to comment https://forums.phpfreaks.com/topic/31820-how-to-change-pagephp-to-page/#findComment-147550 Share on other sites More sharing options...
Kitty Posted December 25, 2006 Author Share Posted December 25, 2006 Thanks, I didn't think about folders. How would I do it using .htaccess? Link to comment https://forums.phpfreaks.com/topic/31820-how-to-change-pagephp-to-page/#findComment-147552 Share on other sites More sharing options...
tomfmason Posted December 25, 2006 Share Posted December 25, 2006 Assuming that you are using apache as the webserver, use mod_rewrite.Here is a simple example that should do exactly what you asked for. This will process domain.com/foo/ as domain.com/foo.php[code]RewriteEngine onRewriterule ^foo/ foo.php [L][/code]Now say you wanted to process all requests to domain.com/foo/request/ as /reguest.php you would do this..[code]RewriteEngine onRewriterule ^foo/(.+)\/ $1.php [L][/code]Hope that helps,Tom Link to comment https://forums.phpfreaks.com/topic/31820-how-to-change-pagephp-to-page/#findComment-147556 Share on other sites More sharing options...
Kitty Posted December 25, 2006 Author Share Posted December 25, 2006 Thank you, should I write all pages like that?EDIT//It didn't work.. Link to comment https://forums.phpfreaks.com/topic/31820-how-to-change-pagephp-to-page/#findComment-147558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.