Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-13 00:34:25

NeilA
Member
From: Blue Mountains, Australia
Registered: 2004-08-15
Posts: 316
Website

TxP and other directories

Can I check with someone what the expected behaviour is here:

I want to have a directory off the root of a domains public space, that is to be used for file exchange between a client of mine and his customers.
It will be protected by it’s own htaccess file.

Can I expect this to work OK with TxP running the web site on that domain?
I guess what I’m asking is whether TxP htaccess stuff will interfere with this non-Txp directory?

Update: It doesn’t work – get TxP sticking it’s oar in and calling it a 404 when I try to access files in that directory via a browser.
So this requires a mod to TxP’s htaccess file, is that right?
Can some kind person point in the right direction to tell TxP to ignore this directory?

Thanks.

Last edited by NeilA (2006-04-13 00:49:23)


Neil – Blue Mountains, Australia

http://westserve.org
http://ministrygrounds.net.au

Offline

#2 2006-04-13 02:45:03

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: TxP and other directories

Add to the .htaccess file in that directory: RewriteEngine Off

Offline

#3 2006-04-13 03:06:46

typewriter
New Member
Registered: 2006-04-10
Posts: 5

Re: TxP and other directories

What does your .htaccess look like (the txp one)? It should work with the default one:

— snip —<br /> RewriteEngine On<br /> RewriteCond %{REQUEST_FILENAME} -f [OR]<br /> RewriteCond %{REQUEST_FILENAME} -d<br /> RewriteRule ^(.+) – [PT,L]<br /> <br /> RewriteRule ^(.*) index.php<br />
— snip —<br />

The two RewriteCond lines are checking if a file or a directory you’re requesting exists . The next line (first RewriteRule) tells mod_rewrite to do no substitution (-), PassThrough the request, and that it is the Last (ignore next line, as one of the conditions has been met). In other words, ignore it.

If the request does not match, txp takes over and tries to figure out what it is you’re looking for. When it doesn’t find it, it dies with a 404 error.

Is the protected directory below the txp .htaccess file?
Are you positive the request you’re making matches the directory structure?

Offline

#4 2006-04-13 04:06:36

NeilA
Member
From: Blue Mountains, Australia
Registered: 2004-08-15
Posts: 316
Website

Re: TxP and other directories

@Mary – thanks for that… but it doesn’t change anything. ;-)

@Typewriter – my TxP .htaccess is bog standard.

Here’s what’s happening:
Without any htaccess file in the ‘share’ directory, typing the URL in gives me a file listing (except there are no files in there). This is good – except that I need password protection on that directory.

With the following htaccess and matching htpassword file in the ‘share’ directory:
<code>
RewriteEngine Off
AuthType Basic
AuthUserFile /home/johndickson/web/share/.htpasswd
AuthName “Download Area”
require valid-user
</code>

I get a TxP 404.
If it makes any difference, the site hosted with Dreamhost.

Be gentle with me here, I’m an htaccess newbie. ;-)

Last edited by NeilA (2006-04-13 04:07:12)


Neil – Blue Mountains, Australia

http://westserve.org
http://ministrygrounds.net.au

Offline

#5 2006-04-13 05:19:52

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: TxP and other directories

That’s very strange. First, Textpattern’s rewrite rules specifically say not to handle real files/directories (which yours is). Second, the rewrite engine off rule should further force this.

I wonder if it is the location of your .htpasswd file that’s interferring?

I don’t know what else to try/recommend at this point, hopefully someone more knowledgable than I can help. :S

Offline

#6 2006-04-13 05:27:34

NeilA
Member
From: Blue Mountains, Australia
Registered: 2004-08-15
Posts: 316
Website

Re: TxP and other directories

Thanks Mary!

I think you are right in one thing: It’s tied up with the password protection.

If I delete the htpassword file, nothing changes (a TxP 404)
If I delete the lines in ‘share’s htaccess file pertaining to the password protection, I get the file listing of the directory (which I would expect).

Just in case something is different in my TxP htaccess, here it is:

<pre>
#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php </IfModule> #php_value register_globals 0 </pre>

Anyone else understand this?

Last edited by NeilA (2006-04-13 05:28:18)


Neil – Blue Mountains, Australia

http://westserve.org
http://ministrygrounds.net.au

Offline

#7 2006-04-14 06:10:05

NeilA
Member
From: Blue Mountains, Australia
Registered: 2004-08-15
Posts: 316
Website

Re: TxP and other directories

RESOLVED.

Don’t ask me how this works or why, but it does.

I dug around a bit in the Dreamhost wiki and after some experimentation, found that if I added these lines:

RewriteCond %{REQUEST_URI} ^/share/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ – [L]

Directly after this line in TxP’s htaccess file:

RewriteRule ^(.+) – [PT,L] <br /> It works. Password access is in place, and TxP doesn’t interfere with the URL… (Note: ‘share’ is the name of the directory concerned)

Hope this helps someone else…


Neil – Blue Mountains, Australia

http://westserve.org
http://ministrygrounds.net.au

Offline

Board footer

Powered by FluxBB