Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

htaccess include

Status
Not open for further replies.

Masali

Programmer
Jun 19, 2002
143
SE
Is it possible to include a external file to htacess? I have several virtual domains that should be allowed hotlinking between each other but not from outside, and I want to redirect differently according to the domain.

So if i had htaccess'es for eg. 3 domains (domain1.com, domain2.com and domain3.com) like this:

For domain1

Code:
RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain1.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain1.com(/)?.*$[/URL]     [NC]

RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain2.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain2.com(/)?.*$[/URL]     [NC]

RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain3.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain3.com(/)?.*$[/URL]     [NC]

RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ [b][URL unfurl="true"]http://www.domain1.com/errorfordomain1.html[/URL][/b] [R,N]

For domain2

Code:
RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain1.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain1.com(/)?.*$[/URL]     [NC]

RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain2.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain2.com(/)?.*$[/URL]     [NC]

RewriteCond %{HTTP_REFERER} !^[URL unfurl="true"]http://(www\.)?domain3.com(/)?.*$[/URL]     [NC]
RewriteCond %{HTTP_REFERER} !^([URL unfurl="true"]www\.)?domain3.com(/)?.*$[/URL]     [NC]

RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ [b][URL unfurl="true"]http://www.domain2.com/errorfordomain2.html[/URL][/b] [R,N]

etc....

Then it would be great if i could use some kind of include since all the rewritecond's always are the same for all htaccess'es, only rewriterule differs.

Anyone has any ideas? Would really appreciate some tips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top