Forum Moderators: phranque

Message Too Old, No Replies

How Do I 'UNDO' Rewrite Rules In Other Folders?

         

mlewitz

1:11 am on Nov 8, 2007 (gmt 0)

10+ Year Member



In the root directory, my .htaccess file has several Rewrite conditions. For example, I have one Rewrite rule to rewrite all extensions to .html and another Rewrite rule to change every request from HTTP to HTTPS.

I installed zen-cart and of course don't want to Rewrite every .php to .html So, as a quick fix, I just put another .htaccess in the zen-cart main directory with just a simple "RewriteEngine Off" command. The problem is it's written to run under HTTP and I want to keep the connection secure with HTTPS.

How can I turn/keep the "RewriteEngine On" and just have the Rewrite to HTTPS rule?

Is this allowed (will this actually work):

RewriteEngine Off
RewriteEngine On
RewriteCond %{SERVER_PORT}!^443$
RewriteRule ^(.*)$ [mywebdomain.com...] [R,L]

Thanks in advance!
~Mike

jdMorgan

2:55 pm on Nov 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not clear what that's supposed to do, but it won't do anything, because the engine is turned on immediately after being turned off, so it ends up being on anyway.

I suspect that what you want/need to do is to add an exclusion (using RewriteCond) to this rule, so that no URLs referencing the cart will invoke the rule. Assuming that the cart stuff is located in /cart and in directories below /cart/, you'd just add:


RewriteCond %{REQUEST_URI} !^/cart/

to your rule, and it would then be skipped for all URL-paths beginning with "/cart"

Jim

mlewitz

6:26 am on Nov 9, 2007 (gmt 0)

10+ Year Member



Thanks Jim. I'll give that a try. It makes sense and I never thought of trying something like that.

And, by the way, Jim... I notice you post a LOT on this forum and I have to tell you that there are a LOT of people here like me who would be COMPLETELY LOST without your input... and I just wanted to say thanks again for all your contributions. I no doubt speak for everyone when I tell you that we are all very grateful.

Thanks again!

~Mike