Welcome to TalkGraphics.com
Results 1 to 10 of 10

Thread: .htaccess

  1. #1
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,339

    Default .htaccess

    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.

  2. #2
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: .htaccess

    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

  3. #3
    Join Date
    Feb 2015
    Location
    Riverside, CA
    Posts
    218

    Default Re: .htaccess

    Are these commands essentially flushing cache at the given intervals? I'm unclear on what is being achieved here.

  4. #4
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: .htaccess

    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

  5. #5
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,339

    Default Re: .htaccess

    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?

  6. #6
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: .htaccess

    Egg, so when the cache is loaded with everything, future visits are faster?
    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.

    Also if I empty my cache in my browser, I guess it has to load everything in again for it to expire?
    Correct

    Also what if an image is changed or text added, does it still loadup in the browser?
    No, it loads from cache.

    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

  7. #7
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,339

    Default Re: .htaccess

    Thank you for the explanation. Does this help with SEO?

    Also what does this mean ExpiresDefault "access 2 days"

  8. #8
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,339

    Default Re: .htaccess

    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

  9. #9
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: .htaccess

    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
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	export.jpg 
Views:	56 
Size:	41.8 KB 
ID:	128048  
    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

  10. #10
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,339

    Default Re: .htaccess

    Thank you. Your the best.

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •