vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=322503

Hiding .php with .htaccess file
by I.G.O.T.A.
02 May 2016 15:31

Is it possible to hide the .php extension in the .htacess file? If so what is the best way to do you?

Thank you,
JJ

Paul M 02 May 2016 20:59

What do you mean by "hide it" ?

Dave 02 May 2016 21:02

http://stackoverflow.com/a/8371815/6275228

I don't see why you would want to do that though. If you currently have SEO .htaccess rules in place, it may mess up.

I.G.O.T.A. 03 May 2016 11:34

Quote:

Originally Posted by Paul M (Post 2570020)
What do you mean by "hide it" ?

it would be just forum instead of forum.php

Quote:

Originally Posted by Dave (Post 2570021)
http://stackoverflow.com/a/8371815/6275228

I don't see why you would want to do that though. If you currently have SEO .htaccess rules in place, it may mess up.

I got that all taken care of, but I can't seem to get nothing to work to hide the extension. I can do it on Xenoforo, but not with vB.

In Omnibus 03 May 2016 12:12

The extension is a function of the browser, not of the software.

I.G.O.T.A. 03 May 2016 23:49

Quote:

Originally Posted by ProSportsForums (Post 2570057)
The extension is a function of the browser, not of the software.

So there is no way to do this?

Dave 03 May 2016 23:54

It is possible, you just have to find the right .htaccess rules to rewrite any requests not containing .php in the URL to its version with .php in it. On top of that you should check if the file exits using another .htaccess rule.

cellarius 04 May 2016 07:52

This is what I have been using in the past with non vB-sites:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Anyway - all of this will not remove the file extensions in vB, i.e. the links in the software will still be .php.

Having this used before: it works, but I would advise against using it. I wouldn't go through the potential trouble just for cosmetic reasons.

Paul M 04 May 2016 13:35

The question is why do you want to do it ?

There is the option to use "Mod Rewrite Friendly URLs" in vB4, which (obviously) has to be combined with some htaccess rules (supplied) which will basically do what you want (use urls with no .php extension).

I.G.O.T.A. 04 May 2016 14:55

Quote:

Originally Posted by Paul M (Post 2570113)
The question is why do you want to do it ?

There is the option to use "Mod Rewrite Friendly URLs" in vB4, which (obviously) has to be combined with some htaccess rules (supplied) which will basically do what you want (use urls with no .php extension).

We have that working, but the main forum still shows the .php. We've tried to hide with the code we have below and it works for what you see below, but not for the main forum.

# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
RewriteRule ^entries/.* entry.php [QSA]


All times are GMT. The time now is 19:44.

Powered by vBulletin® Version 3.8.14
Copyright © 2022, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.