MyBB Community Forums

Full Version: hide .php in url script is killing my login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am currently trying to remove .php from my urls. I have found success with this code except it is killing my login. Basically once in place it does not allow me to login. I get the login popup but I get redirected as if the cookie does not set. Can anyone help with this of perhaps a different way of removing .php from my links.

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

## hide .php extension snippet

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]

# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
Provide your board URL and a testing account

EDIT: @down, testing account would help me find the issue, perhaps.. But if you don't want help then not.
(2015-05-18, 03:53 PM)Destroy666 Wrote: [ -> ]Provide your board URL and a testing account

Don't have the code live as it kills login. Not sure what a test account would accomplish. If I added it you would not be able to log in.

Add this code to .htaccess:

#RewriteEngine on
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]

EDIT: Hold on. That doesn't work either. I thought it did... but, now I can't post anymore.