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?
This is interesting:
if I delete the TXP .htaccess, then access to the osC Admin (giving a username and password), and while logged to the osC admin, I upload the TXP .htaccess again, I have no problems to keep using and navigating thru the osCommerce admin.
I mean, I dont get any 404 error after I logged in, even with the TXP .htaccess in the server (uploaded after I get access to the admin side, of course).
So, all this issue seems to be related with the password-protection and the authentication.
The code lines related to the authentication are:
<code>AuthType Basic
AuthName “osCommerce Admin Side”
AuthUserFile “/home/xxxxxx/.htpasswds/catalogo/admin/passwd”
require valid-user</code>
Last edited by maniqui (2005-09-09 23:29:05)
Offline
#17 2005-09-13 02:07:10
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
I’m moving this to the ‘textpatter’ forum, because it seems to be an osCommerce problem.
Alex
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
But it’s not really an osCommerce problem, I think. I’m having the same type of problems and I’m using a completely different script (a stats script). It has to do with password protecting a directory with .htaccess and htpasswd (at least for me, it is… and seems to be the same for maniqui.)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
I think chrisrhee is right.
My Oscommerce installation is working since one year and few months ago. I also use TXP since one year ago.
This problem started after upgrading to 4.0.
I made a mistake when I said that it worked for me by changing some lines (both in TXP .htaccess and in osCommerce .htaccess). It was just an ilution, produced by loggin first to osC admin and then adding the TXP .htaccess.
And that didnt fixed after upgrading to TXP 4.0.1.
If I delete my TXP .htaccess and keep osC .htaccess, I can log to osCommerce admin by using a password.
If I keep TXP .htaccess and keep osC .htaccess, I only get a 404 error managed by TXP.
If I keep TXP .htaccess and delete osC .htacces, I can access to the osC admin without using password.
So, I differ with Zem. I dont think this is an osCommerce problem but… there is something we must admit:
I think TXP is, by far, more “up-to-date” with last technologies and servers configuration than osCommerce.
osCommerce MS2.2 is the choice of thousands of users since some years. Maybe, tt has been tested in all kind of servers and behind many differents server configurations.
But i think an osCommerce installation isnt up-to-date to take advantage of the last advances in servers, databases, php, etc. I also hear that osCommerce code is a little messing (too many hands?)…
But, again, it works, it has been working for years.
In the other hand, <strong>TXP is a more recent script, more up-to-date, an piece of code art, a fine piece of pottery, taking advantages of the latest web-technologies and standard coding practices, but also concerned in giving backward compatibility many kinds of <em>not-so-up-to-date</em> server configurations.</strong> But TXP is younger, and maybe all the marvelous features (like clean URLs, in this case) hasnt been tested in many kinds of conditions.
So, maybe… maybe… osCommerce is causing all this problem for not-being so up-to-date to standards practices as TXP.
Or maybe, TXP is causing this problem because it still needs to be tested and tunned and tweaked to work with other older scripts… maybe the mod_rewrite needs a cleanest implementation (I’m not a developer, but I think it is very very clean… but maybe it can be… cleaner).
Well
my two cents (I dont know what does it mean, but I read too many english forums and lot of signatures have that)
<small>thanks and excuse my english</small>
Last edited by maniqui (2005-11-12 17:04:02)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
If I delete my TXP .htaccess and keep osC .htaccess, I can log to osCommerce admin by using a password.
If I keep TXP .htaccess and keep osC .htaccess, I only get a 404 error managed by TXP.
If I keep TXP .htaccess and delete osC .htacces, I can access to the osC admin without using password.
That’s exactly how it is for me (just replace osC with the stats script I’m using). I doubt it has to do with osC because like I said, mine is completely different and like yours, everything was working fine until I went from TXP RC3 to 4.0.1, which has a different .htaccess file for TXP.
Last edited by chrisrhee (2005-09-13 04:31:42)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
This is not an oSC problem but a TXP htaccess problem. After upgrading to 4.0.1 from 1.x and installing the new TXP htaccess file, other directories under the site root and protected by htaccess (vbulletin) all give 404 errors. Removal of the TXP htaccess results in vB directories working again.
Our vBulletin htaccess file is:
AuthType Basic
AuthName “Moderator Access Only”
AuthUserFile “/home/xxxxx/.htpasswds/board/modcp/passwd”
require valid-user
This worked perfectly well until TXP upgrade. Now the url results in a 404 when using the new TXP htaccess. Help please! :)
Last edited by Frank (2005-10-05 20:38:43)
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
Tried this line and it fixes the problems with vbulletin. However, this also breaks textpattern’s clean URLs.
RewriteCond %{REQUEST_URI} !^/board/.* [OR]
Offline
#23 2005-10-06 01:22:42
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
That’s because it’s the opposite of what you need. Try it without the !.
Alex
Offline
Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?
On the same note, when I try to access a script in the cgi-bin, TXP redirects to a 404 page. This is new with 4.0.1, though, as when I was using rc3 (I think), this didn’t happen.
bludrop studios .::. Creative Expression
Offline
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