Cant get mod_rewrite to work

Fix it!!

Cant get mod_rewrite to work

Postby Derwood » Fri Oct 15, 2004 7:27 pm

OK.. I've tried this about 100 different ways, including examples here.
I have people direct linking to images on my site. I've followed the directions for putting info in the .htaccess but the images are still coming up.

Here's whats currently in my htaccess:

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?you_domain.com(/)?.*$     [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?you_domain.com(/)?.*$     [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|wmv|mpg|mpeg|avi)$ http://www.you_domain.com/404.gif [R,NC]
RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*you_domain.com/ [NC]
RewriteCond %{HTTP_COOKIE} !(^|(.+;)*)id=valid(;.*|$)
RewriteRule /*$ http://www.you_domain.com/404.gif [L,R]


I've also tried

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteRule .*\TTT $ [L]


Also, to no avail.
I have the mod_rewrite lines in my httpd.conf so that the module is loaded when apache starts.. Do I need to restart apache after updating the htaccess files? What am I missing???

Any help would be appreciated.
Derwood
 
Posts: 1
Joined: Fri Oct 15, 2004 7:22 pm

Postby Caterham » Fri Dec 10, 2004 4:27 pm

use
Code: Select all
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?you_domain.com(/)?.*$     [NC]
RewriteRule .+\.(gif|jpg|jpeg|bmp|wmv|mpg|mpeg|avi)$ 404.gif [R,NC]
Do I need to restart apache after updating the htaccess files? What am I missing???
1st: No
2nd: Watch out for <Directory /www/htdocs> (your path) in your httpd.conf. Look, if
Code: Select all
Options +FollowSymLinks
is set and also
Code: Select all
AllowOverride FileInfo
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 17 guests

cron