This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -iname '.htaccess' -exec sed 's/Deny from all//' -i {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !/maintenance.html$ | |
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 | |
RewriteRule $ /maintenance.html [R=302,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
#Replace ?mysite\.com/ with your blog url | |
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC] | |
RewriteCond %{HTTP_REFERER} !^$ | |
#Replace /images/nohotlink.jpg with your "don't hotlink" image url | |
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FilesMatch "(install\.sql|config\.php|config\.php\.sample)$"> | |
deny from all | |
</FilesMatch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ErrorDocument 400 /errors/badrequest.html | |
ErrorDocument 401 /errors/authreqd.html | |
ErrorDocument 403 /errors/forbid.html | |
ErrorDocument 404 /errors/notfound.html | |
ErrorDocument 500 /errors/serverr.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FileETag MTime Size | |
<ifmodule mod_expires.c> | |
<filesmatch "\.(jpg|gif|png|css|js)$"> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 year" | |
</filesmatch> | |
</ifmodule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Limit GET POST> | |
order allow,deny | |
deny from 200.49.176.139 | |
allow from all | |
</Limit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function words_limit( $str, $num, $append_str='' ){ | |
$words = preg_split( '/[\s]+/', $str, -1, PREG_SPLIT_OFFSET_CAPTURE ); | |
if( isset($words[$num][1]) ){ | |
$str = substr( $str, 0, $words[$num][1] ).$append_str; | |
} | |
unset( $words, $num ); | |
return trim( $str ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = "http://example.org/"; | |
if (preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) { | |
echo "Your url is ok."; | |
} else { | |
echo "Wrong url."; | |
} |
NewerOlder