htaccess Tricks #7 – WordPress Tricks

October 17th, 2008 | by whazup |

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:

  • htaccess Tricks #8 – Random Tricks
    Activate SSI for HTML/SHTML file types: # activate SSI for HTML and or SHTML file types AddType text/html .html AddType text/html .shtml AddHandler server-parsed .html AddHandler 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 IE6 ExpiresActive On Exp...
  • 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...
  • htaccess Tricks #3 – Performance
    Improving Performance via AllowOverride Limit the extent to which htaccess files decrease performance by enabling AllowOverride only in required directories. For example, if AllowOverride is enabled...

Tags: , ,

Post a Comment