Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-09-08 04:18:31

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

TXP works but other scripts dont work because TXP. mod_rewrite issue?

As the title says, my TXP seems to works flawlessly, but other scripts dont work.
Especifically, the osCommerce admin side.

First: this has been pointed <a href=“http://forum.textpattern.com/viewtopic.php?pid=74810#p74810”>here</a> and <a href=“http://forum.textpattern.com/viewtopic.php?id=10754”>here (in spanish)</a>.

It seems that the mod_rewrite in .htaccess is causing some scripts to fail.

I’m using the following scripts:
- BBClone (works): mysite.com/bbclone/
- Noah Classifieds (works): mysite.com/clasificados/
- osCommerce visitor side (works): /catalogo/
- osCommerce Admin side (not working): /catalogo/admin/

It didnt work with TXP 4.0: when I tried to get to de osC admin, by typing the url www.mysite.com/catalogo/admin/, it only takes me to my site homepage (managed by TXP).

So, I made some changes to my .htaccess (you can see the changes <a href=“http://forum.textpattern.com/viewtopic.php?pid=74810#p74810”>here</a> in the reply number 16) and it started to work (i mean, I could get to my osC admin side with those changes).
My actual TXP .htaccess is this:

<pre><p><code>
AddDefaultCharset UTF-8
Options -Indexes
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml

&#35; DirectoryIndex index.php index.html
Options +FollowSymLinks
&#35; RewriteBase /

&lt;IfModule mod_rewrite.c&gt;<br /> RewriteCond %{REQUEST_URI} ^/catalogo/admin/(.*)$ [OR]<br /> RewriteEngine On<br /> RewriteCond %{REQUEST_FILENAME} -f [OR]<br /> RewriteCond %{REQUEST_FILENAME} -d<br /> RewriteRule ^(.+) – [PT,L]<br />
<br /> RewriteRule ^(.*) index.php
&lt;/IfModule &gt;
</code></p></pre>

But yesterday, I have tried to get the osC admin and again, the browser took me to my site frontpage (managed by TXP).

So, Zem suggested me to upgrade to 4.0.1.
So, I did it.
It still doesnt work… but now I’m not taken to my site homepage. Now, the browser returns a “Textpattern Error” (error 404) when I try to get to my osC admin.

Trying to find out why other scripts worked but not the osC admin, <strong>I have deleted the .htaccess inside /catalogo/admin/.</strong>
When I pointed the browser to the osC admin URL, <strong>I did succesfully entered to the admin side of osC</strong>.

So, it seems there is something “wrong” in the osC admin .htaccess.
This is the content of that file

<pre><p><code>
&#35; $Id: .htaccess,v 1.1 2003/06/20 00:18:30 hpdl Exp $
&#35;
&#35; This is used with Apache WebServers
&#35;
&#35; For this to work, you must include the parameter ‘Options’ to
&#35; the AllowOverride configuration
&#35;
&#35; Example:
&#35;
&lt;Directory “/usr/local/apache/htdocs”&gt; AllowOverride Options
&lt;/Directory&gt;
&#35;
&#35; ‘All’ with also work. (This configuration is in the
&#35; apache/conf/httpd.conf file)

&#35; The following makes adjustments to the SSL protocol for Internet
&#35; Explorer browsers

&lt;IfModule mod_setenvif.c&gt; &lt;IfDefine SSL&gt; SetEnvIf User-Agent “.MSIE.” \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 &lt;/IfDefine&gt;

&lt;/IfModule&gt;

&#35; Fix certain PHP values

&#35; &lt;IfModule mod_php4.c&gt;
&#35; php_value session.use_trans_sid 0
&#35; php_value register_globals 1
&#35; &lt;/IfModule&gt;

AuthType Basic
AuthName “osCommerce Admin”
AuthUserFile “/home/USUARIO/.htpasswds/catalogo/admin/passwd”
require valid-user</code></p></pre>

I dont want to delete the .htaccess of the osC admin, ‘cause if I do that, the admin becames unprotected (no password needed).

So, is there any changes in .htaccess (both TXP and osC admin) that can be done without compromise my osC admin security?

I hope this can be resolved in the TXP side… ‘cause in my opinion, this is a problem triggered by TXP and the implementation of mod_rewrite.

Of course, neither I dont want to go back to messy URLs…

So, any advice? any workaround?

Thanks <small>and excuse my poor english</small>.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2005-09-08 04:53:20

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

I don’t think you’re likely to find the answer on the Textpattern forum.

mod_rewrite is complex, very sensitive to the local server environment and configuration, and very difficult to debug, particularly when there are multiple subdirectories and .htaccess files involved.

We’ve designed the Textpattern .htaccess file to pass through requests for existing files and directories (the -f and -d part), and that works on most servers. Unfortunately, there are any number of ways to configure a server so that our carefully written rules fail silently.

What you need is a mod_rewrite expert familiar with your server.

Best advice I can give in the meantime is to use messy URLs, and disable the Textpattern .htaccess file.


Alex
tstate

Offline

#3 2005-09-08 18:43:14

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

Zem, thanks for the advice.

The problem seems to be in the following lines in the .htaccess of osCommerce admin directory.

<code>
&lt; Directory “/usr/local/apache/htdocs” &gt;
AllowOverride Options
&lt; /Directory &gt;
AuthType Basic
AuthName “osCommerce Admin”
AuthUserFile “/home/midimidi/.htpasswds/catalogo/admin/passwd”
require valid-user
</code>

If I delete (or comment) those lines, I can get access to the osCommerce Admin.
Of course… the osCommerce admin directory becomes no longer password-protected, so, that solution is not a deal.

If I leave this lines uncommented, I just only get an Error 404.

I cant find the relation between the protection of my folders and the mod_rewrite managed by TXP.

I would like that .htaccess in the osC admin folder override all the TXP .htaccess directives… but dont know if this is possible.

I dont want either to use messy URLs… I like it clean! hihihihih
the true is that I hardcoded most of my menus… I dont want to change them…

This used to work… There were no problems in previous TXP releases (before 4.0).

Well, I need to keep searching.
Thanks.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2005-09-08 19:32:00

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

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

Change that to: AllowOverride All

Offline

#5 2005-09-08 19:55:29

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

mary,
I have tried your suggestion, but I get the same Error 404 yet.

thanks anyway.

We have to keep searching… there must be a solution!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2005-09-08 23:53:57

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

Simple question: does the oscommerce .htaccess work when the Textpattern .htaccess is removed?


Alex
tstate

Offline

#7 2005-09-09 01:04:46

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

Mmmmm…
weird.

when I remove the TXP .htaccess and keep the osCommerce admin .htaccess, I get an 500 Internal Server error (why?) when trying to reach the osC admin.

If I remove the osC admin .htaccess and keep the TXP .htaccess, I can access the osC admin without giving a password.

If I remove both .htaccess, I can also access the osC admin.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2005-09-09 01:13:02

zem
Developer emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

when I remove the TXP .htaccess and keep the osCommerce admin .htaccess, I get an 500 Internal Server error (why?) when trying to reach the osC admin.

Then the problem is with the oscommerce .htaccess, and is not caused by Textpattern’s.


Alex
tstate

Offline

#9 2005-09-09 01:20:28

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

Thanks, Zem.

I will have to dig deeper…
This used to work just few weeks ago…
And today I talk with the hosting support… I have tried to explain all this to them… but I think they didnt understand…
thanks again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2005-09-09 01:22:27

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

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

500 error would mean there’s an error in the OSCommerce .htacess file, causing the server to… puke? It could be a long list of things, so I recommend you go to the source. :)

Offline

#11 2005-09-09 13:04:04

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

EDIT: <strong>It was an illusion. This hasnt been fixed yet. I forgot to upload the TXP .htaccess.</strong>

I cant believe it!
Finally… I fixed it!

All I had to do was deleting this lines from the oscommerce .htaccess:
<code>
&lt; Directory “/usr/local/apache/htdocs” &gt;
AllowOverride Options
&lt; /Directory &gt;
</code>

I really dont know what those lines mean or do (any thoughts? i hope that they are not important).
Those lines are there by default. I mean, they are “stock” lines in the osC .htaccess.

I started to suspect of those lines when I found this alert in the Error Log of cPanel:

<code>
/home/xxxxxx/public_html/catalogo/admin/.htaccess: &lt;Directory not allowed here
</code>

So, I thought that the “Directory” in this alert was the same as the “Directory” directive in the .htaccess. (I really dont know if this is a correct reasoning or it was just a chance).

So, I delete those lines.
Then, my admin worked, asking me for a password.

I hope I dont compromise my security by deleting that directive in the .htaccess. did I?

But still, it is a mistery. Those lines are there since I installed osCommerce 1 year ago, and never had any problem. I will ask my hosting.

Thanks to mary and Zem for their help and support, <small>and excuse my english</small>.

EDIT: <strong>It was an illusion. This hasnt been fixed yet. I forgot to upload the TXP .htaccess.</strong>

Last edited by maniqui (2005-09-09 20:03:34)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#12 2005-09-09 14:38:02

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: TXP works but other scripts dont work because TXP. mod_rewrite issue?

New found:

IF I delete this line

&lt; Directory “/usr/local/apache/htdocs” &gt;
AllowOverride Options
&lt; /Directory &gt;

AND also delete the TXP .htaccess

AND point the browser to the osCommerce Admin directory, I can get access with password protection.

So, without the TXP .htaccess and without that directive in osC .htaccess, the password protection works..

But I cant figure out any conclusion.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB