Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Update: My mistake. It was just a coincidence that modifying textpattern’s .htaccess had any effect.
—
I *think * I have a solution to this problem, but need more imput since I’m not 100% sure what some of the changes I have made affect.
I changed this line in the .htacess file: RewriteRule ^(.+) - [PT,L]
To this: RewriteRule ^(.+) - [L] #remove PT,
I can now view pages that are protected with an HTTP-Auth password.
I get these 404 errors occassionaly. I’m still not 100% sure what causes them. I suspect it has something to do with my host, 1&1. Still, it’d be nice to know the root cause. Does knowing that removing the PT (pass-through) flag give anyone clues as to what the culprit might be? (The other strange thing is that there should be no other handlers being called. The .htaccess files in the inaccessible directories just have auth information.)
Last edited by ramanan (2006-01-21 16:51:31)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Hi ramanan,
have you read this FAQ?
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Assuming you’ve already tried the FAQ way of doing things and it didn’t work for you (like it failed to work for me), I developed this script and added it to the top of my root index.php file:
$directory = "/root-relative/web/path"; // NO trailing slash here
$dir_length = strlen($directory);
if ( strtolower($directory) == substr(strtolower($_SERVER['REQUEST_URI']),0,$dir_length) ) die;
If you want to protect multiple directories, here’s the array version:
$protected_directories = array("/root-relative/web/path", "/another/path"); // NO trailing slashes here
foreach ($protected_directories as $directory)
{
$dir_length = strlen($directory);
if ( strtolower($directory) == substr(strtolower($_SERVER['REQUEST_URI']),0,$dir_length) ) die;
}
It worked for me. Hopefully you experience the same results. =)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Did anyone come up with a working solution for the txp / osComm htaccess issue? I just installed OsComm and am having the exact same issue as maniqui not being able to access the admin panel. I don’t know a thing about htaccess files, but would really appreciate it if someone could offer a solution. I’ve searched these forums and google and can’t seem to find an answer anywhere.
Any help would be greatly appreciated. Thanks in advance!
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Hi ramblingwebgirl:
did you try the solution suggested in the FAQ?
How do I get password-protected directories (with .htaccess) to co-exist with textpattern?
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Thanks for your quick reply.
Yes, I did try that solution. However, there’s every chance I set it up wrong. This is what I’ve posted in my htaccess file:
<code>
#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
ErrorDocument 401 /[path_to_file]/myerror.html
ErrorDocument 403 /[path_to_file]/myerror.html
</code>
I changed /[path_to_file]/ to my actual file path. I gather that isn’t right though because it’s not working. Any suggestions?
Last edited by ramblingwebgirl (2007-04-30 13:54:34)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
In [path_to_file]
… did you put the URL of the site or the actual path inside the server? (I’m not sure if I’m using the correct terms).
I mean: in [path_to_file]
you have to put something like /home/your_hosting_user_name/more_path_if_needed/
and not something like www.mysite.com/myerror.html
.
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Yep, I put the direct file path: /home/…/
I did a clean install of osCom and it still doesn’t work. Very odd. I have no idea how else to get this to work.
Maybe the TextComm application will be ready soon. :)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Did you try some variant of the script I posted?
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Hi Nathan. I tried that too, both adding it to the TXP index.php and the index.php in my root directory with no luck and I’m pretty sure I’ve followed all of the instructions to a t so I’m at a loss for why it won’t work.
I don’t think our hosting has any particular restrictions either because we host a number of sites all with various scripts and databases and we’ve never had a problem. Thanks for your help regardless.
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Hi Nathan. I got your script working which is great. However, it appears at the top of each of my pages now and if I put it inside <?php then it doesn’t work at all. I’m sure this is a really basic problem, but I’m a designer, not a coder, so again I have no clue how to fix it. Any advice?
Thanks for your input. Cheers!
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Glad to hear it’s working! Sorry to hear it’s only semi-working!
I’ll be happy to look at it if you either e-mail me or post here your full index.php file (from your root directory) and especially if you can send me the link to the site and/or URL where you’re experiencing the problem. My e-mail address is my username @gmail.com or you can post it here if you’d rather.
You aren’t by chance hosting with Dreamhost, are you?
Take care!
Offline