Forums / Install & configuration / Rewrite Rule to Leave SSL

Rewrite Rule to Leave SSL

Author Message

Rob Pratt

Thursday 23 March 2006 10:50:49 pm

I'm stuck on Apache rewrite rules for moving a user to SSL when in the webshop and then moving out of SSL when the user leaves the webshop. I have no problem going to secure, as the following rules work in the httpd.conf for the nonsecure virtual host:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*/plain/shop/(.*) https://%{SERVER_NAME}/plain/shop/$1 [R,L]

After searching and searching and searching this forum and working for hours to write rewrite rules for the httpd.conf for the secure virtual host, I'm stuck.

Can someone refer me to rules that might work to figure out if a URL is not in the webshop and rewrite to the nonsecure server?

All of the rewrite conditions I've tried cause infinite redirects. From reading the mod_rewrite docs, I'm led to believe that it should be as simple as:

RewriteCond %{PATH_INFO} !^.*/plain/shop/(.*)
RewriteRule ^.*/$ http://%{SERVER_NAME}/$1 [R,L]

But it's not.

Jonny Bergkvist

Friday 24 March 2006 1:10:35 am

Hi,

I have a working apache-ssl config that redirects back to http.

I use https for user-login (/user/*), and http for anything else.

The rewriterules in my normal apache-config are:
RewriteRule ^(.*)/user/(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L]
RewriteRule !\.(gif|css|jpg|png|jar|ico|js|pl)$ /ezroot/index.php

The rewriterules in my ssl-config are:
RewriteRule ^(.*)/user/(.*)$ /ezroot/index.php [L]
RewriteRule \.(gif|css|jpg|png|jar|ico|js)$ %{REQUEST_URI} [S=1]
RewriteRule ^(.*) http://%{HTTP_HOST}$1 [L]

Hope this helps :-)

Jonny

Rob Pratt

Monday 27 March 2006 11:01:02 am

Thanks for the example. I'll give it a try.

eZ debug

Timing: Jan 18 2025 11:22:19
Script start
Timing: Jan 18 2025 11:22:19
Module start 'content'
Timing: Jan 18 2025 11:22:19
Module end 'content'
Timing: Jan 18 2025 11:22:20
Script end

Main resources:

Total runtime0.7750 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.1641180.8281
Module start 'content' 0.00660.6265 769.9922510.8359
Module end 'content' 0.63310.1419 1,280.8281333.0859
Script end 0.7750  1,613.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.5275210.0002
Check MTime0.00140.1866210.0001
Mysql Total
Database connection0.00150.189310.0015
Mysqli_queries0.702290.60431940.0036
Looping result0.00230.30211920.0000
Template Total0.745196.120.3726
Template load0.00210.276520.0011
Template processing0.743095.860620.3715
Template load and register function0.00030.036810.0003
states
state_id_array0.00110.145310.0011
state_identifier_array0.00220.289420.0011
Override
Cache load0.00180.2331280.0001
Sytem overhead
Fetch class attribute can translate value0.00120.160030.0004
Fetch class attribute name0.00220.288540.0006
XML
Image XML parsing0.00130.173030.0004
class_abstraction
Instantiating content class attribute0.00000.001540.0000
General
dbfile0.00250.3167270.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs