Restrict htaccess action on sub-directory

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
sponna
Forum Members
Forum Members
Posts: 15
Joined: Fri Jan 04, 2008 8:04 pm

Restrict htaccess action on sub-directory

Post by sponna »

Hi,

I'm running CMSMS successfully at the root level but struggling to get an ecommerce application running in a sub-directory /shop.

I have pretty urls enabled using the htaccess supplied as standard with CMSMS and I know this is causing the problems in the sub-directory - the issue goes away if I disable the CMSMS htaccess in the root.

I tried adding this line to the htaccess file to restrict any action on the sub-directory but no success:

RewriteCond %{REQUEST_URI} !^/shop

This was just before these lines:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Can anyone help with what I need to add to htaccess to exclude action on the /shop sub-directory please?

Thanks for your help,
Dave
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Restrict htaccess action on sub-directory

Post by velden »

IF /shop is a physical directory existing in your website's root, the
RewriteCond %{REQUEST_FILENAME} !-d
should already prevent url rewriting for that part of your website IIRC.
sponna
Forum Members
Forum Members
Posts: 15
Joined: Fri Jan 04, 2008 8:04 pm

Re: Restrict htaccess action on sub-directory

Post by sponna »

Hi,

Thanks for the speedy reply - appreciated.

I've just been checking again and it seems that the store pages in /shop are actually working now I've cleared the local cache. However, the admin of the store - /shop/admin is not working correctly. I can actually access but changes I make are not updating correctly. I disabled the root CMSMS htaccess and all works fine so there is a conflict there.

Is it something to do with the store admin in the sub-dir being password protected? Sorry I'm not very familiar with complex htaccess directives. I did just spot a similar issue on the Drupal forums where a similar "disallow" is recommended but they also advise to place this in the htaccess in the affected sub-dir:

ErrorDocument 401 "Unauthorized"

No idea what that means but I'm away to research and test.

Any other ideas gratefully received,

Thanks
Dave
sponna
Forum Members
Forum Members
Posts: 15
Joined: Fri Jan 04, 2008 8:04 pm

Re: Restrict htaccess action on sub-directory

Post by sponna »

No - that didn't work....

Any other assistance welcomed.

Thanks
Dave
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Restrict htaccess action on sub-directory

Post by velden »

You probably have to look at the access and error log of your webserver.

What url is used for saving the Admin settings and probably the POST method is involved etc.

.htaccess and mod_rewrite are a 'little' complex and it's very hard to just use trial and error method. You should know what you're doing.

I'm not an expert on mod_rewrite unfortunately.
sponna
Forum Members
Forum Members
Posts: 15
Joined: Fri Jan 04, 2008 8:04 pm

Re: [Solved] Restrict htaccess action on sub-directory

Post by sponna »

Hi,

Issue resolved. Thanks for your help.

It wasn't the redirects but the "expires" header set in the htaccess. This needs to be switched off in an htaccess file in the sub directory:

"ExpiresActive off"

Thanks
Dave
Post Reply

Return to “The Lounge”