Andrew H Posted August 5, 2013 Share Posted August 5, 2013 (edited) My shop doesn't redirect from http:// domainname.com to http:// www.domainname.com and I've checked all my settings are correct. In another post someone recommended making the following edit to the htaccess file, which I added right at the top (so it's not overwritten). I took out the command "RewriteEngine On" since this already appears below. I can confirm that this does enable the redirection to work correctly. RewriteCond %{HTTP_HOST} ^domainname.com$ RewriteRule (.*)$ http://www.domainname.com/$1 [R=301,L] However, (this is related to another post I've just made about performance) in addition to the cache setting, I've found this edit to the htaccess file causes intermittent performance issues (so bad that the site practically crashes). I can only guess that some kind of loop/conflict is being created with the existing htaccess content that is generated automatically (although I'm not really sure). Can anyone help me enable this redirect functionality so that it doesn't cause such performance issues? Edited August 5, 2013 by Andrew H (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted August 5, 2013 Share Posted August 5, 2013 you redirect doesn't work (I think) because if it's www, it will not match and then not redirect, well amongst other problems with your code...that is the most obvious. Try this: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] </IfModule> note this will not account for non www. though that is easy enough to add Link to comment Share on other sites More sharing options...
Andrew H Posted August 5, 2013 Author Share Posted August 5, 2013 Thanks for your response. This is how I implemented the code, at the top, above the automatically generated code... The below works, but causes performance issues. Could you tell me how to modify your version to cover redirecting non-www to www RewriteCond %{HTTP_HOST} ^domainname.com$ RewriteRule (.*)$ http://www.domainname.com/$1 [R=301,L] # ~~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> RewriteEngine on RewriteCond %{HTTP_HOST} ^www.domainname.com$ RewriteRule . - [E=REWRITEBASE:/] RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L] Link to comment Share on other sites More sharing options...
El Patron Posted August 6, 2013 Share Posted August 6, 2013 I don't know why it would cause performance issues. Just saying it causes performance issues does not necessarily mean that is the issue. so it's working...can you describe why you think this is related to a performance issue? also this would be better asked or researched outside of prestashop, i.e. based on your OS 1 Link to comment Share on other sites More sharing options...
Andrew H Posted August 6, 2013 Author Share Posted August 6, 2013 (edited) I might have been wrong about it causing performance issues, but I moved your suggested code under the automated htaccess content and don't seem to have had too many more problems. However, I noticed I have a 30MB with 517,000 rows ps_guest table which I'm thinking might actually be my cause of slow performance. Thanks again for your help. I've been advised in a different post that this table is safe to delete (my overall database is only about 80MB so 30MB on ps_guest seems a bit excessive). Here is my other post: http://www.prestasho...81#entry1329881 Edited August 6, 2013 by Andrew H (see edit history) 1 Link to comment Share on other sites More sharing options...
Andrew H Posted August 7, 2013 Author Share Posted August 7, 2013 To confirm, htaccess was not the cause of slow performance, it was a 30MB ps_guest database table which after emptying, the site is superfast -see link above. I would close this topic but not sure how. thanks 1 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