gavpedz Posted May 5, 2017 Posted May 5, 2017 Hi all i will be moving over to IPS next week. I am currently running xenforo and use this in my .htaccess file. Will this be fine to use in ips .htaccess files as well. Any adjustments or recommendations welcome. I am on cpanel php7 Apache ## TURN OFF ETAG ## Header unset Pragma FileETag None Header unset ETag ## TURN OFF ETAG ## ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresByType application/pdf "access 1 month" ExpiresByType audio/x-wav "access 1 month" ExpiresByType audio/mpeg "access 1 month" ExpiresByType video/mpeg "access 1 month" ExpiresByType video/mp4 "access 1 month" ExpiresByType video/quicktime "access 1 month" ExpiresByType video/x-ms-wmv "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType text/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresDefault "access 1 month" </IfModule> ## EXPIRES CACHING ## ## Deflate ## <FilesMatch "\\.(js|css|html|htm|php|xml)$"> SetOutputFilter DEFLATE </FilesMatch> ## Deflate ## ## GZIP ## <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </IfModule> ## GZIP ##
SaltyBart Posted May 5, 2017 Posted May 5, 2017 This is my, maybe you can something whit it: ## IPS Suite Forum SEO <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://your_stite.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> ## End IPS Suite Forum SEO ## Begin - Expires caching <IfModule mod_expires.c> ## This rule will create an ETag for files based only on the modification timestamp and their size. ## Note: It may cause problems on your server and you may need to remove it FileETag MTime Size SetOutputFilter DEFLATE Header set Expires "max-age=29030400, public" Header unset ETag FileETag None # Enable expiration control ExpiresActive On # Default expiration: 1 hour after request ExpiresDefault "now plus 1 hour" # CSS and JS expiration: 1 week after request ExpiresByType text/css "now plus 1 week" ExpiresByType application/javascript "now plus 1 week" ExpiresByType application/x-javascript "now plus 1 week" # Image files expiration: 1 month after request ExpiresByType image/bmp "now plus 1 month" ExpiresByType image/gif "now plus 1 month" ExpiresByType image/jpg "now plus 1 month" ExpiresByType image/jpeg "now plus 1 month" ExpiresByType image/jp2 "now plus 1 month" ExpiresByType image/pipeg "now plus 1 month" ExpiresByType image/png "now plus 1 month" ExpiresByType image/svg+xml "now plus 1 month" ExpiresByType image/tiff "now plus 1 month" ExpiresByType image/vnd.microsoft.icon "now plus 1 month" ExpiresByType image/x-icon "now plus 1 month" ExpiresByType image/ico "now plus 1 month" ExpiresByType image/icon "now plus 1 month" ExpiresByType text/ico "now plus 1 month" ExpiresByType application/ico "now plus 1 month" ExpiresByType image/vnd.wap.wbmp "now plus 1 month" ExpiresByType application/vnd.wap.wbxml "now plus 1 month" # Other optimizations ExpiresByType application/x-gzip "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" </IfModule> ## End - Expires caching This part is only by SSL: RewriteRule ^(.*)$ https://your_stite.com/$1 [R=301,L] Note: This was advise to my, i'am not a expert in this So, back-up always if you change something like this.
ABGenc Posted May 5, 2017 Posted May 5, 2017 The top part ( IfModule mod_rewrite.c) @Bart (R-023) has posted is the default code from IPS . You can keep the mod_expires part too which I also have a similar code in mine. I believe you might need to insert a line for Xenfoto URL sto IPS URLs redirection though.( I had to when I moved from SMF ) @gavpedz why do you use 2 compression methods for the same files ? @Bart (R-023) I did not have to use a redirection rule for HTTPS, IPS script does the whole thing ?
gavpedz Posted May 5, 2017 Author Posted May 5, 2017 Thanks, @ABGenc are you referring to the gzip and deflate? To be honest i am not sure it is just stuff i have collected over time so not sure really what the idea setup for this is. In regard to redirection from xenforo to IPS i thought i set that in the admin panel when i do the conversion. I am planning to convert over next week.
ABGenc Posted May 5, 2017 Posted May 5, 2017 40 minutes ago, gavpedz said: Thanks, @ABGenc are you referring to the gzip and deflate? To be honest i am not sure it is just stuff i have collected over time so not sure really what the idea setup for this is. In regard to redirection from xenforo to IPS i thought i set that in the admin panel when i do the conversion. I am planning to convert over next week. Yes they seem to be doing the same thing. Normally you would have one compression and that would include all types of files you like to compress. The method to use would depend on what module is installed on the server. Redirection line is not a must , normally the conversion script would do the job but sometimes additional work may be needed. That was the Case for me and Support had a huge help on that
gavpedz Posted May 5, 2017 Author Posted May 5, 2017 22 minutes ago, ABGenc said: Yes they seem to be doing the same thing. Normally you would have one compression and that would include all types of files you like to compress. The method to use would depend on what module is installed on the server. Redirection line is not a must , normally the conversion script would do the job but sometimes additional work may be needed. That was the Case for me and Support had a huge help on that Thanks so after having a look it seems deflate is the one i need to use. Looking at the code @Bart (R-023) added is this deflate or something different as it doesn't seem to have file types? SetOutputFilter DEFLATE Header set Expires "max-age=29030400, public" Header unset ETag FileETag None
ABGenc Posted May 5, 2017 Posted May 5, 2017 I am using cPanel installed server and cPanel already has an option to enable deflate using UI. If you also have cPanel I think you can also set it as follows. https://documentation.cpanel.net/display/ALD/Optimize+Website As you said you need to declare the file types for deflate in terms of MIME TYPES as ; text/html text/plain text/xml text/javascript text/css application/x-javascript application/javascript application/xhtml+xml
gavpedz Posted May 8, 2017 Author Posted May 8, 2017 On 2017-5-5 at 7:07 PM, ABGenc said: I am using cPanel installed server and cPanel already has an option to enable deflate using UI. If you also have cPanel I think you can also set it as follows. https://documentation.cpanel.net/display/ALD/Optimize+Website As you said you need to declare the file types for deflate in terms of MIME TYPES as ; text/html text/plain text/xml text/javascript text/css application/x-javascript application/javascript application/xhtml+xml Ah thanks yes i have that option. Totally forgot that was in cpanel to be honest as only ever really access whm on our server. In Cpanel i actually have two options compress all and compress by mimi types. So i have selected all and removed from my .htaccess
ABGenc Posted May 8, 2017 Posted May 8, 2017 27 minutes ago, gavpedz said: Ah thanks yes i have that option. Totally forgot that was in cpanel to be honest as only ever really access whm on our server. In Cpanel i actually have two options compress all and compress by mimi types. So i have selected all and removed from my .htaccess Glad it is solved I prefer to choose one by one as Picture files are already compressed and there is no gain recompressing them
gavpedz Posted May 8, 2017 Author Posted May 8, 2017 Why are picture files already compressed? Does IPS do this or you have other means of compressions for images?
ABGenc Posted May 8, 2017 Posted May 8, 2017 3 minutes ago, gavpedz said: Why are picture files already compressed? Does IPS do this or you have other means of compressions for images? Since raw Picture formats require too much space, all formats like JPG, JPEG are already compressed which is not related to IPS at all. That is why I dont prefer to re compress them. http://stackoverflow.com/questions/4957172/why-i-should-not-compress-images-in-http-headers
Recommended Posts
Archived
This topic is now archived and is closed to further replies.