The post Add far future expiry header to your site first appeared on Server Sitters.
]]>You can set when cache expires by Seconds, Minutes, Hours, Days, Weeks, Months, and Years. You can set a default expires date, by using ExpiresDefault
For example “ExpiresDefault 1 month” would set the default expiration of cache to be one month from now.
To add expires header to all of the images, Javascript, and CSS files, you can use the following code in a .htaccess file
<FilesMatch “\.(ico|jpg|gif|png|jpeg|js|css|swf)$”>
ExpiresDefault “access plus 2 weeks”
</FilesMatch>
The above code will cache the file types listed for 2 weeks before the browser will try to get new ones.
One thing to keep in mind with this however is that the browser will not check for updates until the cache expires. So you’ll want to be careful with the file types you are setting this on, as well as how long you are setting it. For example, if you have a .jpg file that you change every few days, then you should not set the expires headers to 2 weeks. It should only be a day or 2.
You can specify individual files like this in a .htaccess
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/jpg A604800
The default is set to 0 seconds, so everything would expire right away. The jpg is set to 1 week.
A604800 is one week in seconds (60*60*24*7)
The “A” in the timestamp is required. It means to expire from the date it was viewed. Alternatively, you can swap the “A” for an “M”. An “M” Means from the time the file was last modified.
The post Add far future expiry header to your site first appeared on Server Sitters.
]]>The post A properly formated wordpress htaccess first appeared on Server Sitters.
]]>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The above is the default wordpress .htaccess file. And should help to troubleshoot if anything in your own is wrong.
The post A properly formated wordpress htaccess first appeared on Server Sitters.
]]>The post Force http to redirect to https via a .htaccess file first appeared on Server Sitters.
]]>If https is not on, then rewrite the url to https
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://yourdomain.com/$1 [R,L]
If the site is not loaded on port 443, then rewrite to the url to https:
RewriteEngine On
RewriteCondition %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
If the site is loaded on port 80, then rewrite the url to https:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
The post Force http to redirect to https via a .htaccess file first appeared on Server Sitters.
]]>The post Unexpected T_STRING in an Apple iWeb site. first appeared on Server Sitters.
]]>Parse error: syntax error, unexpected T_STRING in /home/username/public_html/index.html on line 1
To correct this, you need to turn short_open_tags off in PHP.
Here are 2 ways to do this:
php_flag short_open_tag off
— OR —
php_value short_open_tag 0
Find the line that says short_open_tag in php.ini and turn it off
The post Unexpected T_STRING in an Apple iWeb site. first appeared on Server Sitters.
]]>The post Manually re-install FrontPage Extensions first appeared on Server Sitters.
]]>On a cPanel server, to reinstall frontpage extensions from the command line, do the following.
*** Note this is destructive
cd ~theirusername/public_htmlfind ./ -iname '_*' -print0 | xargs -0 rm -Rffind ./ -iname '.htaccess' | xargs rm -ffind ./ -iname '*.lck' | xargs rm -frm /usr/local/frontpage/$domainname.com*rm /usr/local/frontpage/www.$domainname.com*These commands delete all folders starting with an underscore (_), all .htaccess files, and all files with an extension of .lck. It then deletes the server configuration files for frontpage itself for the domain. Once these have been deleted, frontpage has been fully removed from the server.
To re-install frontpage, run this command.
/scripts/setupfp5 $domainname.comDepending on the size of this site, this can take a few seconds, or several hours. Once completed, the customer will need to re-publish the site and/or recalculate hyperlinks.
The post Manually re-install FrontPage Extensions first appeared on Server Sitters.
]]>The post Apache Handlers first appeared on Server Sitters.
]]>
| application/x-hdf | hdf |
| application/vnd.wap.wbxml | wbxml |
| image/x-xbitmap | xbm |
| image/x-icon | ico |
| image/vnd.djvu | djvu djv |
| application/x-troff-me | me |
| application/perl | pl plx ppl perl pm |
| application/x-tcl | tcl |
| image/bmp | bmp |
| text/x-sql | sql |
| image/png | png |
| text/x-log | log |
| audio/x-realaudio | ra |
| application/x-latex | latex |
| application/x-director | dcr dir dxr |
| text/rtf | rtf |
| application/xhtml+xml | xhtml xht |
| application/vnd.ms-powerpoint | ppt |
| application/x-csh | csh |
| image/svg+xml | svg |
| application/x-troff-ms | ms |
| image/x-rgb | rgb |
| application/x-img | img |
| image/jpeg | jpeg jpg jpe |
| image/x-portable-pixmap | ppm |
| text/plain | asc txt |
| image/cgm | cgm |
| application/x-sh | sh |
| application/andrew-inset | ez |
| application/vnd.wap.wmlscriptc | wmlsc |
| text/x-registry | reg |
| video/vnd.mpegurl | mxu |
| image/ief | ief |
| audio/x-pn-realaudio | ram rm |
| image/x-xpixmap | xpm |
| video/mpeg | mpeg mpg mpe |
| text/tab-separated-values | tsv |
| application/rdf+xml | rdf |
| application/x-httpd-php | phtml php php3 php4 php5 php6 |
| x-conference/x-cooltalk | ice |
| image/tiff | tiff tif |
| text/richtext | rtx |
| text/css | css |
| application/ruby | rb |
| application/x-wais-source | src |
| application/xml | xml xsl |
| application/voicexml+xml | vxml |
| image/x-portable-graymap | pgm |
| chemical/x-xyz | xyz |
| model/iges | igs iges |
| application/vnd.mif | mif |
| application/mathml+xml | mathml |
| application/x-ustar | ustar |
| application/x-troff-man | man |
| text/vbscript | vbs |
| text/calendar | ics ifb |
| chemical/x-pdb | pdb |
| application/smil | smi smil |
| application/srgs+xml | grxml |
| image/x-portable-anymap | pnm |
| application/x-shockwave-flash | swf |
| audio/mpeg | mpga mp2 mp3 |
| video/x-sgi-movie | movie |
| application/cgi | cgi |
| application/x-cpio | cpio |
| application/x-javascript | js |
| text/x-setext | etx |
| audio/basic | au snd |
| text/sgml | sgml sgm |
| application/x-tar | tgz tar |
| application/vnd.mozilla.xul+xml | xul |
| application/x-futuresplash | spl |
| application/xslt+xml | xslt |
| model/mesh | msh mesh silo |
| application/mac-binhex40 | hqx |
| text/vnd.wap.wml | wml |
| image/x-cmu-raster | ras |
| application/x-sv4cpio | sv4cpio |
| audio/x-aiff | aif aiff aifc |
| application/x-gtar | gtar |
| audio/x-ms-wax | wax |
| audio/x-ms-wma | wma |
| image/x-xwindowdump | xwd |
| application/x-cdlink | vcd |
| application/msword | doc |
| video/quicktime | qt mov |
| application/x-bcpio | bcpio |
| application/x-tex | tex |
| text/x-config | cnf conf |
| application/x-sv4crc | sv4crc |
| application/x-dvi | dvi |
| application/x-troff | t tr roff |
| audio/x-mpegurl | m3u |
| application/x-shar | shar |
| audio/mp4 | a-latm m4p m4a mp4 |
| application/pdf | |
| application/mac-compactpro | cpt |
| application/vnd.wap.wmlc | wmlc |
| video/x-msvideo | avi |
| application/ogg | ogg |
| text/html | html htm shtml |
| image/gif | gif |
| audio/midi | mid midi kar |
| application/x-pkcs7-crl | crl |
| application/x-chess-pgn | pgn |
| audio/x-pn-realaudio-plugin | rpm |
| application/srgs | gram |
| application/x-koan | skp skd skt skm |
| image/vnd.wap.wbmp | wbmp |
| application/x-netcdf | nc cdf |
| model/vrml | wrl vrml |
| application/x-httpd-php-source | phps |
| application/vnd.ms-excel | xls |
| application/postscript | ai eps ps |
| application/x-texinfo | texinfo texi |
| application/zip | zip |
| image/x-portable-bitmap | pbm |
| audio/x-wav | wav |
| application/x-x509-ca-cert | crt |
| application/oda | oda |
| application/xml-dtd | dtd |
| application/octet-stream | bin dms lha lzh exe class so dll iso dmg |
| text/vnd.wap.wmlscript | wmls |
| application/x-stuffit | sit |
The post Apache Handlers first appeared on Server Sitters.
]]>The post Limit access to website based on referrer first appeared on Server Sitters.
]]>
SetEnv PHPRC /home/$user/public_html/php.ini
Then a php.ini file with:
auto_prepend_file = /home/$user/public_html/checkrefer.php
checkrefer.php
<?php
session_start();
echo $_SESSION['allowme'];
//First we check to see if a valid session exists
if ($_SESSION[‘allowme’]==1){
//keep going and allow access
}
else {
$domain=$_SERVER[“HTTP_REFERER”];
$domainref = parse_url($domain, PHP_URL_HOST);
//check to see what the referrer is
if ($domainref==”$validreferdomain”){
//start session and allow access
$_SESSION[‘allowme’] = 1; // store session data
}
//block access bad referrer and no session
else{
print “Access Forbidden. Please visit this page for further information.”;
exit;
}
}
?>
On this script you have to set $validreferdomain = to the referrer you want the visitor to come from.
Limitation – this only effects php pages and not images or other file types. You can get it to lock down html pages by setting the site to parse html as php.
The post Limit access to website based on referrer first appeared on Server Sitters.
]]>The post Disable directory indexing first appeared on Server Sitters.
]]>Options -IndexesThe post Disable directory indexing first appeared on Server Sitters.
]]>The post Disable Zend using a .htaccess file first appeared on Server Sitters.
]]>
php_flag zend.ze1_compatibility_mode offThe post Disable Zend using a .htaccess file first appeared on Server Sitters.
]]>The post Setting CGI to execute outside cgi-bin first appeared on Server Sitters.
]]>Options +ExecCGI
The post Setting CGI to execute outside cgi-bin first appeared on Server Sitters.
]]>