directory/file_from - can be a full path or an individual file (accepts *)ģ. Rsync -avh directory/file_from directory/file_toġ, -avh - archive, verbose and compress/decompressĢ. Simple example called from an Apache2 terminal command window: It is well worth trying simple examples and notice the speed difference between other methods which just copy files such as FileZilla. Enter the size limit in bytes.What is the easiest way to perform this operation.Īssuming both sites use Apache and have PHP installed the easiest way is to use PHP’s rsync command. To prevent users from uploading massive, resource-hogging files, limit the file upload size using. ExpiresActive OnĮxpiresByType image/jpg "access plus 1 year"ĮxpiresByType image/jpeg "access plus 1 year"ĮxpiresByType image/gif "access plus 1 year"ĮxpiresByType image/png "access plus 1 year"ĮxpiresByType text/css "access plus 1 month"ĮxpiresByType application/pdf "access plus 1 month"ĮxpiresByType text/x-javascript "access plus 1 month"ĮxpiresByType application/x-shockwave-flash "access plus 1 month"ĮxpiresByType image/x-icon "access plus 1 year"ĮxpiresDefault "access plus 2 days" Limit file upload size You can set the duration of the cache for each item using all the standard time units, including years, months, weeks, days, hours, minutes and seconds. In order to capitalize on this, you have to set an expiration date for each type of file you want cached. The module is already enabled on most servers, but you’ll need to add the line below to actually use it: AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript Set expires headersīrowser caching speeds up your website significantly. This can reduce the amount of bandwidth your site uses, although it won’t necessarily speed up your site. The Apache mod_deflate module can compress data using gzip compression before transmitting it to the user. With it, you can enable file compression and exert some control over caching, which can substantially speed up your site. You can also modify the above to show an alternate image instead of the one that’s hotlinked, typically one that says something like “No hotlinking allowed!” To do so, change the last line to this: RewriteRule \.(jpg|jpeg|png|gif)$ Site optimization using. htaccessįor search engine optimization, it’s often recommended to stick strictly to a to your site name): #Force WWW You only have to use this once and it will apply from then on in the file unless you turn it off. Perhaps that page no longer exists, or maybe you want to forward them from a non-Note that a lot of these examples begin with the directive RewriteEngine on. Sometimes you need to redirect users to a page other than the one they linked to from their web browser. htaccess to work: URL redirects and rewriting The dot at the beginning of the file name tells Unix/Linux systems to hide this file, so when using file manager, be sure to tick the checkbox for “show hidden files” or you might not be able to find it. What’s the dot at the beginning of the filename for? htaccess.old and that should bring it back up. If you do crash your website and for some reason don’t have a backup, don’t panic - simply rename. htaccess file you can easily break your website, so create a backup first. Related: cPanel tips and tricks that will make your life easier Don’t forget to create a backup. You will now be in the text editor, where you can make and save changes. Under the Files section, click on the File Manager icon.ĥ. htaccess, including the one built into cPanel’s File Manager. htaccess from cPanelĪny text editor can be used to modify. htaccess files on a site, though for ease of maintenance, webmasters often use a single file located in the site root to make all necessary changes. This is useful if you only want to affect a portion of your website, as the file will only affect the directory it’s in and those beneath it. htaccess file in a particular subdirectory farther down in your site’s structure. From there, it will affect all subfolders in the site. htaccess file is most often located in the root of the website it controls.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |