Is this possible (2)?

Discuss practical ways rearrange URLs using mod_rewrite.

Postby joe » Tue May 07, 2002 9:47 am

Hello everyone,

I don't want people to download any file (except html documents) from my server following links on pages hosted elsewhere.

<Directory /xyz/ccc>

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteRule .*.gif$ - [L]


I found this code... working only with gif files, is there any way to block unauthorized access to every file type in this directory except html/htm ?

Thanks in advance :smile:

<font size=-1>[ This Message was edited by: joe on 2002-05-13 19:27 ]</font>
Posts: 1
Joined: Mon May 06, 2002 4:00 pm

Postby Brett » Wed May 15, 2002 9:28 pm

I haven't tested it, but you can probably do something like this:

<Directory /xyz/ccc>
RewriteEngine on
RewriteCond %{REQUEST_URI} !.htm
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?*$ [NC]
RewriteRule .*$ - [L]
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest