Only allow specific referrers with .htaccess

Apr032007 2:30AM — John

Say you have a secret directory full of stuff you don’t want anyone to see and you want to allow certain domains to have access to it directly. All you would need to do is create (or add this to) a .htaccess file in the root of the directory you want to protect.

You would do it thusly:
Add this to a blank or your existing .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?first-domain-to-allow.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?second-domain-to-allow.com/.*$ [NC]
RewriteRule ^(.*)$ http://www.google.com/ [R,L]

Also, if you want people who copy and paste/type in the link to have access, all you would need to do is add this line just after RewriteEngine on so your .htaccess file would look like this…
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?first-domain-to-allow.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?second-domain-to-allow.com/.*$ [NC]
RewriteRule ^(.*)$ http://www.google.com/ [R,L]

Advertising

vBulletin display thread title once in legacy postbit (postbit_legacy)

Apr032007 2:28AM — John

Ok, so you’ve got that brand new VB install and you want it to look like the big boys and only show the title in the first (original) post in a thread… Well here’s how you do it.

In postbit_legacy find this…
<if condition="$show['messageicon'] OR $post['title']“>
<!– icon and title –>
<div class=”smallfont”>
<if condition=”$show['messageicon']“><img class=”inlineimg” src=”$post[iconpath]” alt=”$post[icontitle]” border=”0″ /></if>
<if condition=”$post['title']“><strong>$post[title]</strong></if>
</div>
<hr size=”1″ style=”color:$stylevar[tborder_bgcolor]” />
<!– / icon and title –>
</if>

And change it to this…
<if condition="$post['title']“>
<!– icon and title –>
<div class=”smallfont”>
<if condition=”$show['messageicon']“><img class=”inlineimg” src=”$post[iconpath]” alt=”$post[icontitle]” border=”0″ /></if>
<if condition=”$post['title']“><strong>$post[title]</strong></if>
</div>
<hr size=”1″ style=”color:$stylevar[tborder_bgcolor]” />
<!– / icon and title –>
</if>

This along with disabling “Automatically Quote Post / Thread Title” gives me the desired effect.
You can find that option in…
AdminCP > vBulletin Options > vBulletin Options > Message Posting & Editing Options > Automatically Quote Post / Thread Title

TragicallyNull is looking for guest authors. Click here for details.

Recent Comments

khalid

thanks a million - it was very irritating problem, it is resolved with your suggestion.

Anders Milton

Amazing! I’ve searched for a solution for a long time, but noone seemed to have the same problem. Or at least I couldn’t fint anything....

vagnretur.nu
Adam

Sweet fix thanks man, this had been bugging me lately

cel

yehaaa, this has been doin my haed in for months, my g/f’s comp is ok tough,, cheers m9

Borg

Yeah I’m not all that fond of vi neither. I much better prefer to use ee.

raiwk

thanks, this worked for me.

cendana

Wow … its great tutor. Its work on my FreeBSD 7. So Simple. Thanks

Voos Baratos

thanks for the icon, it does look much better!

sovoosbaratos.com/
Derf

I just bought my Ipod Touch V2.1.1, and was wondering if this would work for me … TY

e

thanks.

Advertising