Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   World's Leading Outsourcing Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 03-02-2008, 11:42 AM   #1 (permalink)
Member
 
Join Date: 08-24-07
Posts: 49
iTrader: 0 / 0%
Latest Blog:
None

homebrewpcgaming is liked by many
Thumbs down .htaccess blocking ONE file and Redirecting it?

Hello,

Ok, I have a file: downloadzip.php?id=WHATEVERNUMBER

I do not want this file to be hotlinked to (other PHP files are fine), so I only want that one file to be protected.

When someone hotlinks to downloadzip.php?id=WHATEVERNUMBER I want them to be redirected to showgame.php?id=WHATEVERNUMBER

What would I put in .htaccess?

Thank you!
Matthew Kremer
homebrewpcgaming is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 07-11-2008, 02:34 PM   #2 (permalink)
Contributing Member
 
Join Date: 07-11-08
Posts: 54
iTrader: 0 / 0%
Latest Blog:
None

wdillsmith is liked by many
If you have apache, you can use
Redirect 301 <old page> <new page>

Replace items inside brackets with actual values. Also, you typically have to use full path on the <new page> (i.e., http://...).

Keep in mind that if you do it this way you will not be able to access the file via http either. So you'll have to pull it down with FTP or something else.

Your other option would be to move it to a password protected directory.
wdillsmith is offline  
Add Post to del.icio.us
Reply With Quote
Old 07-11-2008, 05:53 PM   #3 (permalink)
v7n Mentor
 
Join Date: 07-24-06
Posts: 642
iTrader: 1 / 100%
Latest Blog:
None

nasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nicenasty.web is just really nice
Quote:
Originally Posted by homebrewpcgaming View Post
Hello,

Ok, I have a file: downloadzip.php?id=WHATEVERNUMBER

I do not want this file to be hotlinked to (other PHP files are fine), so I only want that one file to be protected.

When someone hotlinks to downloadzip.php?id=WHATEVERNUMBER I want them to be redirected to showgame.php?id=WHATEVERNUMBER

What would I put in .htaccess?

Thank you!
Matthew Kremer
Code:
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yoursite\.com/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule downloadzip.php\?id=(\d+)$ showgame.php\?id=$1 [L]
You'll also need to replace yoursite\.com .
nasty.web is online now  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with .htaccess file (www. redirection) projectwealth Domain Name Forum 4 01-09-2008 06:32 AM
Need help with HTACCESS file brandnew Coding Forum 2 12-02-2007 11:13 PM
redirecting ur old site to a new one with htaccess recep Coding Forum 3 03-29-2007 05:03 AM
.htaccess file handling eloquent Coding Forum 6 02-01-2007 02:07 AM
Blocking spiders from indexing certain page using .htaccess theChronic Coding Forum 3 12-22-2005 11:09 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 12:53 PM.
© Copyright 2008 V7 Inc