rossh Posted October 20, 2006 Share Posted October 20, 2006 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?ThanksR Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/ Share on other sites More sharing options...
rossh Posted October 20, 2006 Author Share Posted October 20, 2006 Looks like this method does not work in firefox should that be right?ThanksR Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111729 Share on other sites More sharing options...
tomfmason Posted October 20, 2006 Share Posted October 20, 2006 You would want mod rewrite. here is a nice tutorial http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111730 Share on other sites More sharing options...
rossh Posted October 20, 2006 Author Share Posted October 20, 2006 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?ThanksR Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111732 Share on other sites More sharing options...
tomfmason Posted October 20, 2006 Share Posted October 20, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111739 Share on other sites More sharing options...
rossh Posted October 20, 2006 Author Share Posted October 20, 2006 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.ThanksRoss Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111742 Share on other sites More sharing options...
Daniel0 Posted October 20, 2006 Share Posted October 20, 2006 Put this in your .htaccess file: [code]AddType application/x-httpd-php .htmAddType application/x-httpd-php .html[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111748 Share on other sites More sharing options...
tomfmason Posted October 20, 2006 Share Posted October 20, 2006 Here is a very detailed mod rewrite reference.. http://forums.devshed.com/apache-development-15/mod-rewrite-guide-common-requests-267522.htmlreplace the * with a +like thisRewriteRule ^(.+)\.html$ $1.php Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111749 Share on other sites More sharing options...
rossh Posted October 20, 2006 Author Share Posted October 20, 2006 Hi thanks for getting back to me. I've tried both:-Options +FollowSymlinks RewriteEngine onAddType application/x-httpd-php .htmAddType application/x-httpd-php .htmland Options +FollowSymlinks RewriteEngine onRewriteRule ^(.+)\.html$ $1.phpand both give me a 500 error?Thanks againR Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-111787 Share on other sites More sharing options...
wildteen88 Posted October 20, 2006 Share Posted October 20, 2006 Look in your servers error log. The error log will give you a reason why you are getting the 500 Internal Error message. Quote Link to comment https://forums.phpfreaks.com/topic/24521-hiding-php-extension/#findComment-112011 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.