MyBB Community Forums

Full Version: Remove .php extension from url with htaccess without affecting login in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As the subject says i want to remove .php with htaccess. i was able to do that and it work, until i logged out and tried to login again.

i used this in htaccess


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [QSA,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]


but after i logged out i couldnt login again, i'd like my url to be without php extension so is there anyone thats making this work somehow, if so how

http://redink4rums.net
Why dont you simply use Google SEO plugin like your naijawords
No i want to remove the php extensions for pages like stats.php memberlist.php, private.php contact.php and all the others that google seo plugin doesnt change
Oh okay i thought about SEO URLs, Stupid me. Well here is the simple code thats hide .php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Or you can simply do via editing php.ini
by doing "expose_php = Off" it ll hide .php from all php files
Quote:by doing "expose_php = Off" it ll hide .php from all php files

I don't believe that's correct. Can you provide a source? As far as I've always been aware, expose_php = Off will prevent the PHP version from being sent as an HTTP header, and disables certain the PHP logo guids. I've never seen anyone use it to allow files to be accessed without needing to include the .php extension.
(2015-11-06, 03:39 PM)Nathan Malcolm Wrote: [ -> ]
Quote:by doing "expose_php = Off" it ll hide .php from all php files

I don't believe that's correct. Can you provide a source? As far as I've always been aware, expose_php = Off will prevent the PHP version from being sent as an HTTP header, and disables certain the PHP logo guids. I've never seen anyone use it to allow files to be accessed without needing to include the .php extension.


okay i posted wrong as it also required to edit httpd .conf file to work forget it as Apache can do the work without modifying php.ini or .conf file.