MyBB Community Forums

Full Version: Removing .php in URL?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There are couple of other threads asking about this, but no answer. I tried a couple of different scripts, but different issue each time. First, can't login, then can't post in threads because says that thread doesn't exist even though it does, although every time, .php is removed. Here is current script:

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

## don't touch /forum URIs
RewriteRule ^forums/ - [L,NC]

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

It's active right now, so maybe you can check error, board URL: http://spamheaven.com

If need test account... well, .m. and Euan T, you both already have access, but if anyone else who wants to help needs it, I will PM details to you.
Hi,

Why are you trying to hide the .php extension? Can't you just use the rewrite rules provided with MyBB (same as the ones in use on this forum)? Removing the extension is just going to cause more problems unless you also modify the core to reflect your changes.
(2015-06-06, 05:21 PM)Euan T Wrote: [ -> ]Hi,

Why are you trying to hide the .php extension? Can't you just use the rewrite rules provided with MyBB (same as the ones in use on this forum)? Removing the extension is just going to cause more problems unless you also modify the core to reflect your changes.

Well, because it'd look better. Big Grin
And what rewrite rules?
(2015-06-06, 05:25 PM)Marisa Wrote: [ -> ]Tried this?

http://community.mybb.com/thread-171306-...pid1161407

But doesn't that only remove .html?
(2015-06-06, 05:28 PM)Cookie123 Wrote: [ -> ]
(2015-06-06, 05:25 PM)Marisa Wrote: [ -> ]Tried this?

http://community.mybb.com/thread-171306-...pid1161407

But doesn't that only remove .html?

If you enable the SEO URLs setting in the AdminCP it replaces .php with .html in a lot of cases.

What I just linked you edits the setting to change .php into nothing.
If you use the plugin 'Google SEO' it gives you the option to customize URL structure.