Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / .htaccess rewrite with folders and Private SSL?

.htaccess rewrite with folders and Private SSL?

Locked

Views: 2,117

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
12 Sep 2009, 4:51 PM
#1
littlehawk avatar

littlehawk

New Zenner

Join Date:
Jan 2009
Posts:
85
Plugin Contributions:
0

.htaccess rewrite with folders and Private SSL?

Hello,
I just installed a SSL certificate,
and i would like to know is there any way to do a mod rewrite,
that turns and work https://www.domain.com to a sub-folder but still shows https://www.domain.com on the title bar, instead of www.domain/com/folder when applying a redirect.
This is what i done and works in http, but no longer true in SSL servers,RewriteEngine on

#RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
#RewriteCond %{REQUEST_URI} !^/main/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /main/$1

#RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
#RewriteRule ^(/)?$ main/index.php [L]

12 Sep 2009, 5:03 PM
#2
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: .htaccess rewrite with folders and Private SSL?

This works for me:

# Makes catalog seem like the root in the browser address.
# change domain to your url
# change catalog to your sub folder name
# the next 3 line are here if you do not have them already in the file.
Options -Indexes
RewriteEngine on
Options +FollowSymLinks
# 
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule .* http://www.domain.com/ [L,R=301]
RewriteRule ^$ catalog/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/catalog%{REQUEST_URI} -f
RewriteRule .* catalog/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* catalog/index.php?q=$0 [QSA]

Skip

12 Sep 2009, 5:40 PM
#3
littlehawk avatar

littlehawk

New Zenner

Join Date:
Jan 2009
Posts:
85
Plugin Contributions:
0

Re: .htaccess rewrite with folders and Private SSL?

skipwater,
it works like a charm!!!!!!!!!
Thank you very much!!!!!!!!

14 Sep 2009, 3:19 PM
#5
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: .htaccess rewrite with folders and Private SSL?

That's one of the draw backs that I have not been able to work out.

I assume that you are using an ZC error 404 trap in your htaccess file. Or something similar.

ErrorDocument 404 http://www.domain.com/index.php?main_page=page_not_found.php

I know it looks funny but it is a file not found value. Just the address is not cleared when redirected to error page.

Maybe someone else can come up with the clearing command?

Skip

14 Sep 2009, 3:46 PM
#6
littlehawk avatar

littlehawk

New Zenner

Join Date:
Jan 2009
Posts:
85
Plugin Contributions:
0

Re: .htaccess rewrite with folders and Private SSL?

Skipwater, thanks very very much for your reply,
I would like to ask a little bit more, is that where should the link error document should be placed?

14 Sep 2009, 6:10 PM
#7
skipwater avatar

skipwater

Totally Zenned

Join Date:
Jun 2008
Location:
Washington, DC
Posts:
775
Plugin Contributions:
1

Re: .htaccess rewrite with folders and Private SSL?

As a start here is a link to all the error codes and what they mean.
http://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html

Zen Cart has a predefined error page which is: page_not_found.php

To edit the contents of this page you can find it in your:
/includes/templates/YOUR_TEMPLATE/templates/tpl_page_not_found.php

As for the htaccess file just add this line with your url

ErrorDocument 404 http://www.domain.com/index.php?main_page=page_not_found.php