The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Hiding .php with .htaccess file
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 |
#2
|
||||
|
||||
What do you mean by "hide it" ?
|
#3
|
|||
|
|||
<a href="http://stackoverflow.com/a/8371815/6275228" target="_blank">http://stackoverflow.com/a/8371815/6275228</a>
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. |
#4
|
||||
|
||||
it would be just forum instead of forum.php
Quote:
|
#5
|
||||
|
||||
The extension is a function of the browser, not of the software.
|
Благодарность от: | ||
I.G.O.T.A. |
#6
|
||||
|
||||
So there is no way to do this?
|
#7
|
|||
|
|||
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.
|
Благодарность от: | ||
I.G.O.T.A. |
#8
|
||||
|
||||
This is what I have been using in the past with non vB-sites:
Code:
## Internally rewrite extensionless file requests to .php files ## # # If the requested URI does not contain a period in the final path-part RewriteCond %{REQUEST_URI} !(\.[^./]+)$ # and if it does not exist as a directory RewriteCond %{REQUEST_fileNAME} !-d # and if it does not exist as a file RewriteCond %{REQUEST_fileNAME} !-f # then add .php to get the actual filename RewriteRule (.*) /$1.php [L] ## Externally redirect clients directly requesting .php page URIs to extensionless URIs # # If client request header contains php file extension RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.php\ HTTP # externally redirect to extensionless URI RewriteRule ^([^.]+).php$ http://your-domain.com/$1 [R=301,L] ## Force custom error page, since php does not return proper errors after this procedure ("no input file specified") # RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteRule ^.+\.php$ /path/to/errorpage.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. |
Благодарность от: | ||
I.G.O.T.A. |
#9
|
||||
|
||||
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. |
#10
|
||||
|
||||
Quote:
# 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] |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|