Forum Moderators: phranque

Message Too Old, No Replies

htaccess permissions with osCommerce

         

grasshoppa

3:13 am on Apr 10, 2007 (gmt 0)

10+ Year Member


Since adding an htaccess file, I am unable to edit osCommerce. I can edit osCommerce when I disable htaccess.

I've searched for an hour, but haven't found anything.
Here is the htaccess file:
-----

RewriteEngine On

Redirect 301 /oldpage.htm http://www.mysite.com/newpage.htm
(etc....)

Options -Indexes

RewriteCond %{HTTP_HOST} ^mysite.(.*)
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

ErrorDocument 404 http://www.mysite.com/404.html

-----

Any suggestions or similar experiences? Or do I just have to disable htaccess whenvever I edit the cart?

jdMorgan

12:53 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What problem, specifically, do you have when attempting to edit?

It may be that you'll need to add an exclusion to one or more of your .htaccess directives, so that they are not invoked when directory paths involved in editing are accessed. However, I don't know what those paths might be, so I can't be any more specific...

Jim

grasshoppa

3:36 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Thanks for replying.

With htaccess enabled, I am unable to delete or make changes in any fields in configuration, catalog, etc. I can log in as administrator, but can do nothing when logged in.

How would I determine the directory paths invoked when editing?

I guess I should disable the different parts of the file one at a time to see which one is causing the problem. I don't think it would be the 301s, so it's probably either the directory listing or the canonization....

grasshoppa

3:58 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



I can edit when I delete:

RewriteCond %{HTTP_HOST} ^mysite.(.*)
RewriteRule ^(.*)$ [mysite.com...] [R=301,L]

from the htaccess file. Does this mean the osCommerce has issues with the canonicalization?

The rewrite from "/" to "www.mysite.com" seemed to make a real improvement in the serps, so I'd hate to give it up...

jdMorgan

3:59 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> How would I determine the directory paths invoked when editing?

Look at your browser address bar, noting all paths visited while 'editing'. You may or may not need to 'translate' those paths through any applicable redirects or rewrites in your .htaccess file.

Jim

jdMorgan

4:06 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can edit when I delete:

RewriteCond %{HTTP_HOST} ^mysite.(.*)
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]


So in case no-one's around later, what we are talking about, assuming you can identify the oscommerce-edit path(s), is doing something like this:

RewriteCond %{HTTP_HOST} ^example\.
RewriteCond $1 !^path-used-to-edit-oscommerce
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

The new RewriteCond disables the rule if the path "/path-used-to-edit-oscommerce" is accessed. Other minor changes are for efficiency/robustness only. Note no leading slash on the $1 pattern -- it is obtained by back-reference to the (.*) in RewriteRule, where leading slashes are stipped in an .htaccess context.

Jim

grasshoppa

5:44 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Thanks.

I've read through the guides, but I can't figure out how to proceed with two questions.

Under "Configuration", I get this as a typical path:

http://www.example.com/host//catalog/admin/configuration.php?gID=1&cID=2

Under "Catalog",

I get this as a typical path:

http://www.example.com/host//catalog/admin/categories.php?cPath=&cID=1

1) I'm not sure of the wildcard replacement for the dynamic part of the urls.

2) Do I need a separate line for each subdomain (admin/categories. and admin /catalog. ), or is there a wildcard include for everything below admin?

jdMorgan

8:04 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just

RewriteCond $1 !^host/+catalog/admin/

should do, since the only variation is at the end. The only thing strange (looks like a config problem) is the double-slash in your URLs, handled flexibly here by "/+" meaning "one or more consecutive slashes".

Jim

[edited by: jdMorgan at 8:04 pm (utc) on April 10, 2007]

grasshoppa

8:10 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Thanks Jim!