We can cache the file using htaccess so that we can improve the perfomace of a website General Format <FilesMatch “.(Extenstion of the file to be cached)$”> Header set Cache-Control “max-age=cache time″ </FilesMatch> Example <FilesMatch “.(html|htm)$”> Header set Cache-Control “max-age=43200″ </FilesMatch
Daily Archives: December 21, 2011
Remove error messages from the login screen – WordPress
Add the below given code in “functions.php” of the curren template folder
add_filter(‘login_errors’,create_function(‘$a’, “return null;”));
Permanently redirect from www domain to non-www domain
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www.domain.tld$ [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [R=301,L]
Remove /category/ from your category URL
Add the below given code in your .htaccess file
RedirectMatch 301 ^/category/(.+)$ http://www.askapache.com/$1 #
OR
RewriteRule ^category/(.+)$ http://www.askapache.com/$1 [R=301,L]
Set the timezone of the server .htaccess
Add the code “SetEnv TZ America/Los_Angeles” in your htaccess file
Invalid Redirect URL After Upgrade
NOTE : I do not recommend this solution . Though you can follow this temporarily.
I have fixed this issue by commenting the below given code from the page includes>functions.php.
if (!$foundurl) {
eval(standard_error(fetch_error(‘invalid_redirect_url_x’, $vbulletin->url)));
}
Limiting number of simultaneous connections
Add the code in your .htaccess file in to limit the number of simulatious connections
General Format : MaxClients
Example : MaxClients 5
.htaccess – Usage
- Rewriting URLs
- Customized error responses
- Authorization, authentication
- SSI
- Directory listing
- Blocking
- MIME types
- Cache Control
.htaccess
A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration.The original purpose of .htaccess – reflected in its name – was to allow per-directory access control, by for example requiring a password to access the content. Nowadays however, the .htaccess files can override many other configuration settings including content type and character set, CGI handlers, etc.These files are placed inside the web tree, and are able to override a subset of the server’s global configuration for that directory, and all sub-directories
Protect a file using .htaccess
Add the below given code in your .htaccess file
<files filename.php>
order allow,deny
deny from all
</files>