.htaccess tutorial

htaccess Elite


Use htaccess to hide mailto links

Security in htaccess: htpasswd, 401 Authentication

Use htaccess to hide mailto links

Postby produke » 22 Feb 2007 19:30

Create a mail directory, and make an .htaccess file there with the following code:


Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
   
# With subject - mail/domain/com/user/subject
RewriteCond %{REQUEST_URI} ^/mail/(.*)/(.*)/(.*)/(.*)$
RewriteRule ^.* mailto:%3@%1.%2?subject=%4 [R,L]
   
# No subject - mail/domain/com/user
RewriteCond %{REQUEST_URI} ^/mail/(.*)/(.*)/(.*)$
RewriteRule ^.* mailto:%3@%1.%2 [R]



Now to create a mailto link use the following format:

Code: Select all
http://s.com/mail/quan/com/tom => equals tom@quan.com
or
http://s.com/mail/quan/com/tom/test  => equals tom@quan.com with the subject "test"


The email address never really shows up on the web page, so harvesters will miss it.
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48

Return to Security and Authentication