0
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?pirate-punk.com(/)?.*$     [NC]
RewriteRule ([^/]+\.[a-z0-9]+)$ http://www.pirate-punk.com/dl.php?f=$1 [R,NC,L]

Options +Indexes 

This htaccess will redirect all incoming traffic to another page if they come from a different domain.

I would like to exclude all index.php pages from this rule so my visitors can still visit an index.php page even if they come from outside of the domain

How can i do that ?

4

1 回答 1

0

您可以添加一个条件,排除以 a 结尾的任何内容/or /index.php

RewriteEngine On

RewriteCond %{REQUEST_URI} !/(index\.php)?$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?pirate-punk.com(/)?.*$     [NC]
RewriteRule ([^/]+\.[a-z0-9]+)$ http://www.pirate-punk.com/dl.php?f=$1 [R,NC,L]
于 2013-07-03T19:53:26.173 回答