這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Browser Caching with .htaccess

外掛說明

With Browser Caching you can tell Browsers when your files usually change, e.g. every month, every week, etc. This will fasten up your website because Browser will only make requests to your Server after the declared time. PageSpeed is a Google Ranking Factor so it is important to have a fast website.
There a several ways to enable Browser Caching. This Plugin uses Expires. The following code will be added to your .htaccess file:

ExpiresActive On

ExpiresByType text/css “access plus 1 month”

ExpiresByType text/javascript “access plus 1 month”

ExpiresByType text/html “access plus 1 month”

ExpiresByType application/javascript “access plus 1 month”

ExpiresByType application/x-javascript “access plus 1 month”

ExpiresByType application/xhtml-xml “access plus 1 month”

ExpiresByType image/gif “access plus 1 month”

ExpiresByType image/jpeg “access plus 1 month”

ExpiresByType image/png “access plus 1 month”

ExpiresByType image/x-icon “access plus 1 month”

The second line means that css files will be requested after 1 month. The third line means that javascript files will be requested after 1 month and so on.
Of course you can change the periods. You will find instructions for that in the FAQ section.

In case you do not have reading rights to the .htaccess file you will get a 403 Permission Denied Error Page. So before activating this Plugin make sure you have reading rights to the .htaccess file (normally you have those rights).

螢幕擷圖

  • The Plugin Dashboard
  • The impact of a sample .htaccess file, shown after the 'check .htaccess file' button was clicked
  • Error message after 'activate Browser Caching' button was clicked and no .htaccess file was found
  • Success message after Browser Caching was successfully activated
  • To open the modification menu press the 'modify Expires' button
  • Error message that occurs when you are already using Browser Caching

安裝方式

  1. Upload the plugin directory ‘ browser_caching_htaccess’ to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to ‘Tools’ in the Dashboard Sidebarand look for ‘Browser Caching’.
  4. Read the instructions on the Plugin Dahboard.
  5. Check if your website has a .htaccess file. You can either do this by pressing the button ‘check .htaccess file’ or look directly in your ‘root’ directory. Make sure the file is writable.
  6. Also check if you are already using Browser Caching with ‘Expires’. Therefore search for the code shown above in your .htaccess file.
  7. If you are not already using Browser Caching with Expires press the ‘activate Browser Caching’ button and the code will get added to your .htaccess file.
  8. DONE!

常見問題集

Installation Instructions
  1. Upload the plugin directory ‘ browser_caching_htaccess’ to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Go to ‘Tools’ in the Dashboard Sidebarand look for ‘Browser Caching’.
  4. Read the instructions on the Plugin Dahboard.
  5. Check if your website has a .htaccess file. You can either do this by pressing the button ‘check .htaccess file’ or look directly in your ‘root’ directory. Make sure the file is writable.
  6. Also check if you are already using Browser Caching with ‘Expires’. Therefore search for the code shown above in your .htaccess file.
  7. If you are not already using Browser Caching with Expires press the ‘activate Browser Caching’ button and the code will get added to your .htaccess file.
  8. DONE!
Can I change the periods of the Caching?

Yes, to change the periods go the Plugin’s directory, usually found at ‘wp-content/plugins/browser_caching_htaccess/’. Open the file ‘caching.php’ and go to line 21. The defined periods of the Expires are from line 21 to line 30. You can change them there.

Can I change the periods of the caching without editing the code?

Since version 1.1 there is a modification menu on the plugin dashboard. Go to the admin dashboard and click the ‘modify Expires’ button to open the menu.

Can I change the periods of the caching after I already activated the caching?

If you already activated the caching you can not change the periods via the plugin dashboard. First you have to delete the inserted block in you .htaccess file, after that you can change the periods.
When you want to delet the inserte block for changing the periods, you can also change them directly when opening the file on your server.

Can I use Browser Caching without .htaccess file?

To enable Browser Caching this Plugin adds code to your .htaccess file. Therefore this file is necessary for this Plugin.

What do I do when my .htaccess is not writable?

When it is not writable the Plugin can not add code. You have to change the file permissons to e.g. 644.

What happens when I activate Browser Caching even if I already use it in the .htaccess?

Since Version 1.2 this is no longer possible. If youre Apache Server is already configured to use Browser Caching with Expires it is no longer possible to activate Browser Caching again via this plugin.

使用者評論

2017 年 11 月 4 日
This plugin is a must for anyone who isn't currently using expiry headers in their .htaccess, or doesn't know how to implement them. Download, install, activate, and then watch your jaw drop at how fast your website refreshes... BTW you don't need to leave this plugin activated. You can even delete it when you're done, as once it inserts the code into your .htaccess its done its job.
2016 年 9 月 3 日
Excellent plugin, it works perfectly. Many thanks to the developer!
2016 年 9 月 3 日
First I was confused if I should modify the Browser Caching, but after the author helped me I understand the plugin and it works perfectly for me! 🙂
閱讀全部 7 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Browser Caching with .htaccess〉的開發相關工作。

參與者

將〈Browser Caching with .htaccess〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.0

  • added readme.txt
  • added checks to to ckeck if .htaccess exists
  • added prefixes to the Plugins functions

1.0.1

  • added GPLv2 License
  • changed function to display path of .htaccess file on admin dashboard
  • modified readme.txt

1.0.2

  • added Donation button on admin dashboard
  • added Donateion Link to readme file

1.1

  • Now it is possible to modify the time spans of the Expires
  • added new screenshot to explain the new modification menu
  • added FAQ about the new modification function
  • added missing slash in the explanation where the .htacces file should be placed

1.2

  • changed grey buttons to blue buttons
  • added a check if Expires are already written in the .htaccess, so Browser Caching can not be inserted twice
  • added FAQ concerning the new feature
  • added screenshot about error message of new feature

1.2.1

  • added link to Optimizer For Faster Websites Plugin on adminpage