imgrooot Posted July 20, 2016 Share Posted July 20, 2016 This is so strange. I have this bit of code that removes the .php extension from pages so that I can visit any page without typing .php at the end. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] The above code has always worked for me before. But for some reason today it stopped working on localhost and the live server(ipage hosting). Do you know why that might be? Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/ Share on other sites More sharing options...
requinix Posted July 20, 2016 Share Posted July 20, 2016 Type something random and invalid into the file and see if your site starts returning 500 errors. If not then it means your .htaccess file isn't being interpreted anymore and you should talk to your host. Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/#findComment-1534723 Share on other sites More sharing options...
imgrooot Posted July 21, 2016 Author Share Posted July 21, 2016 Type something random and invalid into the file and see if your site starts returning 500 errors. If not then it means your .htaccess file isn't being interpreted anymore and you should talk to your host. I do get 500 errors if I add invalid code in .htaccess. So it does work. It can't just be the live host server because I have the same issue on localhost. Weird thing is, I have another websites with the exact same .htaccess file on localhost and they seem to work fine. Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/#findComment-1534763 Share on other sites More sharing options...
requinix Posted July 21, 2016 Share Posted July 21, 2016 Stuff doesn't just stop working without a reason. If your .htaccess is being parsed and you're not getting 500s as it is now then everything there should be working - unless something changed to break it. So. What changed in the last couple days? Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/#findComment-1534765 Share on other sites More sharing options...
lovephp Posted July 21, 2016 Share Posted July 21, 2016 those codes seems fine working on my system np Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/#findComment-1534783 Share on other sites More sharing options...
imgrooot Posted August 18, 2016 Author Share Posted August 18, 2016 This is very strange but it works for me. Simply having blank spaces between each line makes it work. Like this. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] Quote Link to comment https://forums.phpfreaks.com/topic/301518-removed-php-extension-in-htaccess-but-its-not-working-anymore-do-you-know-why/#findComment-1536326 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.