htaccess Tricks #7 – WordPress Tricks

Secure WordPress Contact Forms
Protect your insecure WordPress contact forms against online unrighteousness by verifying the domain from whence the form is called. Remember to replace the “domain.com” and “contact.php” with your domain and contact-form file names, respectively.

# secure wordpress contact forms via referrer check
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteCond %{REQUEST_POST} .*contact.php$
RewriteRule .* – [F]

WordPress Permalinks
In our article, The htaccess rules for all WordPress Permalinks, we revealed the precise htaccess directives used by the WordPress blogging platform for permalink functionality. Here, for the sake of completeness, we repeat the directives only. For more details please refer to the original article:

If WordPress is installed in the site’s root directory, WordPress creates and uses the following htaccess directives:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If WordPress is installed in some subdirectory “foo”, WordPress creates and uses the following htaccess directives:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foo/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /foo/index.php [L]
</IfModule>
# END WordPress

Related Posts:

  • Add Expires Headers to WordPress
    This article have explained how you can add expiry header to your image, javascript and css files to speed up your site when loading.Adding expires headers do not affect the site load time for a f...
  • htaccess Tricks #8 – Random Tricks
    Activate SSI for HTML/SHTML file types: # activate SSI for HTML and or SHTML file typesAddType text/html .htmlAddType text/html .shtmlAddHandler server-parsed .htmlAddHandler server-parsed ....
  • htaccess Tricks #6 – Redirect Tricks
    Important Note About Redirecting via mod_rewrite For all redirects using the mod_rewrite directive, it is necessary to have the RewriteEngine enabled. It is common practice to enable the mod_rewrite...
  • htaccess Tricks #5 – Usability Tricks
    Minimize CSS Image Flicker in IE6 Add the following htaccess rules to minimize or even eliminate CSS background-image “flickering” in MSIE6:# minimize image flicker in IE6ExpiresActive OnExp...
  • htaccess Tricks #4 – Security
    Prevent Acess to .htaccess Add the following code block to your htaccess file to add an extra layer of security. Any attempts to access the htaccess file will result in a 403 error message. Of cours...

Tags: , ,

17.Oct.08 Server


You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

Leave a Comment

:)