Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-25 22:31:22

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Problem .htaccess on linux server apache

When I try to stop referring links directed to articles placed in the blog, by means of an .htaccess file placed in the root directory, I cannot prevent the access. The .htaccess file is placed in the root directory of the site and the blog is in a sub-directory. Not the same occurres with links refferring to pages placed outside the blog.
Anyone can tell me why and what to do?
I’vealso tried displacing the instructions ‘RewriteCond %{HTTP_REFERER}’ of the root .htaccess in the Textpatter ‘.htccess’, that is not in the root but in a sub-directory, but acting this way I had a server error blocking the accesso to me too.
Thanks

Last edited by Bongo-man (2009-09-25 23:50:04)

Offline

#2 2009-09-26 05:40:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Problem .htaccess on linux server apache

I think that htaccess is directory sensitive.

What I do is use txp’s htaccess and on the top I add the blocking condition.

Order allow,deny
Allow from all
Deny from xxx.xxx.xxx.xxx
Deny from yyy.yyy.yyy.yyy

For referrers try

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} badsite\.com [NC,OR]
RewriteCond %{HTTP_REFERER} anotherbadsite\.com
RewriteRule .* - [F]

Last edited by colak (2009-09-26 05:58:52)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2009-09-26 06:19:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Problem .htaccess on linux server apache

.htaccess applies to all directories below it, unless you override it there with another .htaccess.

I think it’s easier to whitelist your own domain name for access when checking the referrer instead of keeping a blacklist of domains you want to block. Remember to also allow empty referers!

Offline

#4 2009-09-26 13:19:33

Bongo-man
Member
Registered: 2009-03-18
Posts: 243

Re: Problem .htaccess on linux server apache

The solution was in the just script inserted in an .htaccess placed in the blog root directory, that is a sub-directory of my web site. I had tried it before without succeed, but nw I have used the just expression.

Last edited by Bongo-man (2009-09-26 17:44:04)

Offline

Board footer

Powered by FluxBB