What are the necessary things one has to include in the .htaccess file for xara websites?
So far I have the error 404 and https redirect.
What are the necessary things one has to include in the .htaccess file for xara websites?
So far I have the error 404 and https redirect.
I'd suggest you add some expires. Here's one fom my root directory public_html. Adjust the expire dates to suit.
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING
Egg
Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
Are these commands essentially flushing cache at the given intervals? I'm unclear on what is being achieved here.
Hi Dan, perhaps this helps:
Add Expires headers
Web pages are becoming increasingly complex with more scripts, style sheets, images, and Flash on them. A first-time visit to a page may require several HTTP requests to load all the components. By using Expires headers these components become cacheable, which avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often associated with images, but they can and should be used on all page components including scripts, style sheets, and Flash.
Egg
Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
Egg, so when the cache is loaded with everything, future visits are faster? Also if I empty my cache in my browser, I guess it has to load everything in again for it to expire? Also what if an image is changed of text added, does it still loadup in the browser?
Yes, it checks the expire dates and if the asset has been loaded inside the expire period, it loads it back from your computer cache, saving the round trip to the server. If it's outside the expiry period it fetches the asset anew.Egg, so when the cache is loaded with everything, future visits are faster?
CorrectAlso if I empty my cache in my browser, I guess it has to load everything in again for it to expire?
No, it loads from cache.Also what if an image is changed or text added, does it still loadup in the browser?
So you need to think ahead when creating the expires. How often as a webdesigner are you likely to change images? How often will you update pdf file? etc
F5 just reloads from cache. You can force a total reload by hitting Ctrl+F5.
Egg
Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
Thank you for the explanation. Does this help with SEO?
Also what does this mean ExpiresDefault "access 2 days"
Also Egg, can you tell me the xara slider I have on this site, which one does it use, so that I can extend it for a long time since it will not change. clearsoundhearing.ca
Hi Behzad, the images are not on your hosting server, they are on xara-online.com server, therefore the .htaccess file on your clearsoundshearing.ca server has no control over these. To influence the expire re these files (whatever they are) you'd need to place an .htaccess file on the xara-online.com website which you can't do. xara-online.com is very basic and doesn't allow this. I'd avoid that Xara slider widget.
As an aside I'd recommend giving your images meaningful names. Currently they have meaningless names like 1015.png, which are very likely to be renamed 1037.png on another re-publish.
For example if you've set the expire of png's in the .htaccess to 1 year, it becomes meaningless as the image previously named 1015.png no longer exists so it can't be loaded from cache. The browser then needs to get the server to download 1037.png as there's no such image in cache.
BUT if you've given your image a unique name these are retained within your computers cache and are not renamed/renumbered each time you republish your site where you may have added a new image.
This is my understanding of the situation anyway
Egg
Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host
Thank you. Your the best.
Bookmarks