Jump to content

htaccess for IPS Forums


Recommended Posts

Ok. Since upgrading I have been using this

FileETag None
<IfModule mod_deflate.c> 
<filesMatch ".(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
  </filesMatch>
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "now plus 1 week"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType application/x-shockwave-flash "access plus 1 week"
ExpiresByType video/x-flv "access plus 1 week"
ExpiresByType application/pdf "access plus 1 week"
ExpiresByType text/xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>

Is there any benefit in swapping this for your code? I only ask due to lack of knowledge

Link to comment
  • 4 weeks later...

These expires (not just yours, in general) create an issue with opcache, I and many of my members appear to be logged out and are not seeing updated topics (we're not, needs a page refresh to show as logged in and show the latest topic list). This only happens when opcache is enabled, so it is clashing somewhere. In which case, how do I have working image expires when I have opcache active?

Edited by marklcfc
Link to comment
  • 6 months later...
  • 1 month later...

I have just started using this one which i found on another site. Any suggestions with this one considering i have also just started using http2?

<IfModule mod_expires.c>

	ExpiresActive on
	ExpiresDefault                                    "access plus 1 month"
	
	# DATA
	ExpiresByType text/xml                            "access plus 0 seconds"
	ExpiresByType text/html                           "access plus 0 seconds"
	ExpiresByType text/plain                          "access plus 0 seconds"
	ExpiresByType application/xml                     "access plus 0 seconds"
	ExpiresByType application/json                    "access plus 0 seconds"
	ExpiresByType application/rss+xml                 "access plus 1 hour"
	ExpiresByType application/atom+xml                "access plus 1 hour"
	ExpiresByType text/x-component                    "access plus 1 hour"
	
	# MANIFEST
	ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
	ExpiresByType text/cache-manifest                 "access plus 0 seconds"
	
	# SCRIPTS
	ExpiresByType text/css                            "access plus 1 month" 
	ExpiresByType text/javascript                     "access plus 1 month" 
	ExpiresByType application/javascript              "access plus 1 month" 
	ExpiresByType application/x-javascript            "access plus 1 month" 
	
	# IMAGES
	ExpiresByType image/gif                           "access plus 1 month"
	ExpiresByType image/png                           "access plus 1 month"
	ExpiresByType image/jpe                           "access plus 1 month"
	ExpiresByType image/jpg                           "access plus 1 month"
	ExpiresByType image/jpeg                          "access plus 1 month"
	ExpiresByType image/jp2                           "access plus 1 month"
	ExpiresByType image/pipeg                         "access plus 1 month"
	ExpiresByType image/bmp                           "access plus 1 month"
	ExpiresByType image/tiff                          "access plus 1 month"
	ExpiresByType image/svg+xml                       "access plus 1 month"
	ExpiresByType image/vnd.microsoft.icon            "access plus 1 month"
	
	# ICONS
	ExpiresByType image/ico                           "access plus 1 month"
	ExpiresByType image/icon                          "access plus 1 month"
	ExpiresByType text/ico                            "access plus 1 month"
	ExpiresByType image/x-ico                         "access plus 1 month"
	ExpiresByType image/x-icon                        "access plus 1 month"
	ExpiresByType application/ico                     "access plus 1 month"
	
	# AUDIO
	ExpiresByType audio/ogg                           "access plus 1 month"
	ExpiresByType audio/basic                         "access plus 1 month"
	ExpiresByType audio/mid                           "access plus 1 month"
	ExpiresByType audio/midi                          "access plus 1 month"
	ExpiresByType audio/mpeg                          "access plus 1 month"
	ExpiresByType audio/x-aiff                        "access plus 1 month"
	ExpiresByType audio/x-mpegurl                     "access plus 1 month"
	ExpiresByType audio/x-pn-realaudio                "access plus 1 month"
	ExpiresByType audio/x-wav                         "access plus 1 month"
	
	# VIDEO
	ExpiresByType video/ogg                           "access plus 1 month"
	ExpiresByType video/mp4                           "access plus 1 month"
	ExpiresByType video/webm                          "access plus 1 month"
	ExpiresByType video/x-msvideo                     "access plus 1 month"
	ExpiresByType video/mpeg                          "access plus 1 month"
	ExpiresByType video/quicktime                     "access plus 1 month"
	ExpiresByType video/x-la-asf                      "access plus 1 month"
	ExpiresByType video/x-ms-asf                      "access plus 1 month"
	ExpiresByType x-world/x-vrml                      "access plus 1 month"
	
	# FONTS
	ExpiresByType font/truetype                       "access plus 1 month"
	ExpiresByType font/opentype                       "access plus 1 month"
	ExpiresByType application/x-font-ttf              "access plus 1 month"
	ExpiresByType application/x-font-woff             "access plus 1 month"
	ExpiresByType application/font-woff               "access plus 1 month"
	ExpiresByType application/vnd.ms-fontobject       "access plus 1 month"
	
	# FLASH
	ExpiresByType application/x-shockwave-flash       "access plus 1 month"
	ExpiresByType video/x-flv                         "access plus 1 month"
	
	# OTHERS
	ExpiresByType application/pdf                     "access plus 1 month"
	ExpiresByType image/vnd.wap.wbmp                  "access plus 1 month"
	ExpiresByType application/vnd.wap.wbxml           "access plus 1 month"
	ExpiresByType application/smil                    "access plus 1 month"
	
	<IfModule mod_headers.c>
		Header append Cache-Control "public"
	</IfModule>
	
</IfModule>

 

Edited by gavpedz
Link to comment
  • 8 months later...
  • 3 weeks later...
  • 9 months later...

Just a friendly reminder and clarification. I only offer support here in this thread for the htaccess instead of via PM.

This is because if someone else has the same issues, Instead of having someone who may search for the answer and not be able to find it because it was done via PM.

I want that information to be publicly available and allow for quick resolutions for those who may encounter similar issues.

 

Thanks

Link to comment
  • 1 year later...
  • 1 month later...

Unfortunately this file where I flagged that it's compatible with the 4.5 release is being rejected. 😞

There have been no changes to the htaccess since June 15, 2016. The only thing that has is simply marking the compatibility with the 4.5 release of the forums.

I'm working to see if I can resolve this issue.

Link to comment
  • 2 weeks later...
  • 9 months later...
  • 4 weeks later...
On 7/28/2021 at 3:52 PM, CyanideBurial said:

Just a quick suggestion for anyone who uses cloudflare or another CDN, dont use this .htaccess it will cause conflict and your site performance will drop dramatically! i tested it against the standard htaccess and perfermonce went from 93 down to 65.

It'd be great if you could mention what lines are causing the issue/conflict.

Link to comment
  • 2 months later...
  • 1 year later...

Typically I've only seen that issue when using Rocket loader in Cloudflare.  

IPS does not set a cache control header on the file, so Cloudfront does not cache it.  Cloudfront is literally checking ONLY the headers to determine cachability.  Cloudflare is different in that it try to intelligently determine what is catchable.  

With that being said...  I don't think cache status is your problem.  It appearing only on a reload is not a cache issue.  

Per CF's docs:

Quote

Rocket Loader prioritizes your website’s content (text, images, fonts, and more) by deferring the loading of all of your JavaScript until after rendering.

This type of loading (known as asynchronous loading) leads to earlier rendering of your page content. Rocket Loader handles both inline and external scripts, while maintaining order of execution. Cloudflare will detect incompatible browsers and disable Rocket Loader.

I would try checking to see if you have Rocket loader enabled and if so, disable it.  My guess is that is your problem and why a reload fixes your problem because other objects are loaded into the browser cache and therefore are not impacted by Rocket Loader on the subsequent reload of the page.  

Once disabled, flush cache in CF, dump your browser cache, and try again.  

By the way...  not sure I understand why you posted your question in this year old thread that does not seem to be related?

Edited by Randy Calvert
Link to comment
On 11/24/2022 at 4:05 AM, Randy Calvert said:

By the way...  not sure I understand why you posted your question in this year old thread that does not seem to be related?

I was setting the caching directives for Apache, so I found this topic.

My community is not using Cloudflare, but Cloudfront.

I still could not realize how to set the caching on the CDN and on the browser to make config.js loads every time.

Link to comment
  • 2 months later...
On 5/11/2015 at 1:16 AM, Tarun said:

This is a custom .htaccess to use on the IPS Community Suite Forums. It helps to improve your forums Google Page Speed and YSlow scores.

The top segment is the same .htaccess that is generated by the IPS Forum software.

The bottom segment is based upon research of several websites and the references listed below. Please be careful when using this file because the contents may be incompatible with your server setup. Preventative measures have been taken to ensure that it should be safe to use in any Apache based environment.

Google recommends a minimum of one week: https://developers.google.com/speed/docs/insights/LeverageBrowserCaching
GTmetrix recommends a minimum of one month: http://gtmetrix.com/leverage-browser-caching.html

 

This file is provided as-is and works with Apache based systems only. Server configurations may vary and there may be unexpected results, preventative measures have been included to try and keep any problems from occurring.

This resource is not supported. Help will be offered to the best of my ability and the community's help and feedback are welcomed. Contributions to improve the overall performance gained by this file are encouraged.

 

Hi please reupload file. Thanks

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...