Jump to content

Prestashop 1.5.6.2 HTTPS rewrite problems.


Bjarstal

Recommended Posts

I’m stuck with a problem about URL rewriting. I’m setting up my site for SSL and I have bought an expensive certificate from Symantec. It is the kind of certificate that makes the address window turn green. My problem is that ALL URLs must be in HTTPS, if the address window shall turn green. In other words, the img src=”url” must be in HTTPS also.

 

With a few exceptions Prestashop 1.5.6.2 is handling this well by the settings in Backoffice. So it is the exceptions I desperately need your help with and you’ll find them below:

 

The header logo; image source URL and link URL

 

As you can see in the below code the href and the src remain as HTTP

<-- Header -->

<div id="header" class="grid_9 alpha omega">
<a id="header_logo" href="http://www.protectionantivol.fr/" title="BJARSTAL"> 
<img class="logo" src="http://www.protectionantivol.fr/img/logo.jpg?1433170641" alt="BJARSTAL" width="95" height="99" />
</a>

 

I can of course kill the php-code and write it manually but I would like to do it in the right way.
 
 
 
The Breadcrumb “Home” link URL

 

As you can see the href is messing it up. This one I can't modify in the .tpl

 

<!-- Breadcrumb -->
 <div class="breadcrumb">
 <a href="http://www.protectionantivol.fr/" title="retour à Accueil"><img src="https://www.protectionantivol.fr/themes/shop_bjarstal_com/img/icon/home.gif" height="26" width="26" alt="Accueil" /></a>
 <span class="navigation-pipe" >></span>
 <a href="https://www.protectionantivol.fr/34-autre-produits" title="Autre produits">Autre produits</a><span class="navigation-pipe">></span>Classeurs verticaux ignifuges.
 </div>
 <!-- /Breadcrumb --> 
 
 

And this one (the Add to cart-button)

 

<span class="online_only">Exclusivité web !</span> <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_211" href="http://www.protectionantivol.fr/panier?add=1&id_product=211&token=7d8f0f424a41ecc00bc620b8cb98d235" title="Ajouter au panier"><span></span>Ajouter au panier</a>

 

 

The Homslider module

 

All img="URLs" in the homeslider module. The href are manually set, but the img URL I don't understand how to controll

 

!-- Module HomeSlider -->
<script type="text/javascript">
   var homeslider_loop = true;
 var homeslider_speed = 500;
var homeslider_pause = 3000;
</script>
<ul id="homeslider">
   <li>
   <a href="https://www.protectionantivol.fr/6-coffres-forts" title="">
   <img src="http://www.protectionantivol.fr/modules/homeslider/images/fee67adca2d032fbc3fe67e8dcab1bcd.jpg" alt="KEEPS Coffres-forts" height="300" width="535" />
   </a>
  </li>

I suppose it can all be arranged by some setting in some .htaccess but I don't understand how to do it.

Please not that all rewrite rules in place are generated by Backoffice. In any case, below you'l find a copy ot the / .htaccess

 

#START AS4 RULES (Do not remove)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} !^controller=products-comparison [NC]
RewriteRule ^([a-z]{2})?/?s/([0-9]+)/([a-zA-Z0-9/_-]*) index.php?fc=module&module=pm_advancedsearch4&controller=advancedsearch4&isolang=$1&id_seo=$2&seo_url=$3 [QSA,L]
RewriteCond %{QUERY_STRING} ^isolang=([a-z]{2})&id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*)
RewriteRule ^advancedsearch4.php /%1/s/%2/%3? [R=301,L]
RewriteCond %{QUERY_STRING} ^id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*)
RewriteRule ^advancedsearch4.php /s/%1/%2? [R=301,L]
</IfModule>
#END AS4 RULES

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

# Images
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]

# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.protectionantivol.fr$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>

<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType text/css "access plus 1 week"
 ExpiresByType text/javascript "access plus 1 week"
 ExpiresByType application/javascript "access plus 1 week"
 ExpiresByType application/x-javascript "access plus 1 week"
 ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

FileETag INode MTime Size
<IfModule mod_deflate.c>
 <IfModule mod_filter.c>
  AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript
 </IfModule>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# start ~ module watermark section
# Options +FollowSymLinks ****Had to change this to the line below when moving
# to Virtual Server
Options +SymLinksIfOwnerMatch

RewriteEngine On

RewriteRule [0-9/]+/[0-9]+\.jpg$ - [F]
# end ~ module watermark section

Edited by Bjarstal (see edit history)
Link to comment
Share on other sites

I've solved it by myself:

 

1. The "logo" problem I could only solve by modifying the TPL and kill the php code and replace it with pure HTML / CSS

2. Affter carefully having deleted all cache manually and restarted the browser the "Breadcrumb" and the "Add to cart button" problems disaperd.

3. The problem with the image slider module  "Homeslider" I couldn't solve and I had to take the module away.

 

So now all is fine and the address window is green and nice. But isn't there a way to make a rewrite for single rows or modules so I can use the Image slider?

 

All the best

 

Hans

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...