FlorioAlagna Posted June 25, 2015 Share Posted June 25, 2015 (edited) EDIT: I solved it myself by adding redirection rules to /(prestashop)/.htaccess as well Hey everyone, I'm experiencing an odd issue with htaccess redirection: I'd like the server to redirect everything to https and remove the www Here's my htaccess file: RewriteEngine OnRewriteBase /Options +FollowSymLinksRewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})RewriteRule .* index.php [F]RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME}/index.html !-fRewriteCond %{REQUEST_FILENAME}/index.php !-fRewriteRule . index.php [L] It's bugging me to no end. Does anyone have any idea why it happens? I'm, guessing it's the htaccess in /shop, how do I have to modify it to force https and www removal? /shop/.htaccess: # ~~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#Domain: domain.comRewriteRule . - [E=REWRITEBASE:/shop/]RewriteRule ^api$ api/ [L]RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]# ImagesRewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]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]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]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]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]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]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]RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]# AlphaImageLoader for IE and fancyboxRewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]# DispatcherRewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^.*$ - [NC,L]RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]</IfModule>AddType application/vnd.ms-fontobject .eotAddType font/ttf .ttfAddType font/otf .otfAddType application/x-font-woff .woff<IfModule mod_headers.c> <FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$"> Header add Access-Control-Allow-Origin "*" </FilesMatch></IfModule>#If rewrite mod isn't enabledErrorDocument 404 /shop/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 sectionOptions +FollowSymLinksRewriteEngine OnRewriteRule [0-9/]+/[0-9]+\.jpg$ - [F]# end ~ module watermark section Edited June 27, 2015 by FlorioAlagna (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted June 26, 2015 Share Posted June 26, 2015 why not just enable the SSL option in the back office preferences page, with the force all pages option? Link to comment Share on other sites More sharing options...
FlorioAlagna Posted June 26, 2015 Author Share Posted June 26, 2015 It was already set but it wasn't redirecting to https, which I am now doing via htaccess. Link to comment Share on other sites More sharing options...
bellini13 Posted June 27, 2015 Share Posted June 27, 2015 well, you don't say what version of Prestashop you are using, but enabling that option would force Prestashop to redirect automatically to https (front and back) Link to comment Share on other sites More sharing options...
FlorioAlagna Posted June 27, 2015 Author Share Posted June 27, 2015 It's .14. Even if that was the case, the option wouldn't be removing www, which was part of my intention, so I don't understand why you're trying to be annoying just for the sake of it. Link to comment Share on other sites More sharing options...
bellini13 Posted June 28, 2015 Share Posted June 28, 2015 to remove www you would simply enter the domain name without the www in your backoffice configuration page. You came here seeking help, and then are complaining when you received it? Good luck receiving help from me in the future Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now