Arkadia Posted November 22, 2011 Share Posted November 22, 2011 (edited) Hi guys, I'm having a problem with my CMS pages (pages created via tools>CMS>add a new page). I am trying to use friendly urls and it's breaking the links to template images because it adds the word "content" to the URL so it's unable to find the images defined in my css files and my menu module. The images are breaking because they are linking to: http://dev.zelco.com/ content /themes/zelco/img/zelimg/cart_button.jpg instead of: http://dev.zelco.com/ themes /zelco/img/zelimg/cart_button.jpg Pages not created via the CMS work fine. This is more or less what the pages should look like: http://dev.zelco.com/1-home BUT The CMS pages are looking like this: http://dev.zelco.com/content/7-press When I don't use friendly urls then the template works perfectly. But the client would prefer friendly urls. I've looked at the htaccess file but I'm not exactly sure how to change it so that it is able to find the correct directory for the applicable template files. These are the rules (in the htaccess file) that I believe are creating the url with "content" in it. RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 [QSA,L] RewriteRule ^content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 [QSA,L] Appreciate any help! Edited July 26, 2012 by Arkadia (see edit history) Link to comment Share on other sites More sharing options...
Arkadia Posted November 29, 2011 Author Share Posted November 29, 2011 I'm still not winning with this ^ issue. When I view the page source, it shows the correct url, it seems the url is being rewritten by the htaccess file when friendly-urls are applied in the generator section of the prestashop backend. Switching off friendly urls fixes the issue, but I'd prefer to have them on. Anyone out there? Thanks! Link to comment Share on other sites More sharing options...
Arkadia Posted December 8, 2011 Author Share Posted December 8, 2011 Well it doesn't look like anyone reads these forums lol. But I resolved the issue...as simple as relative links missing a forward slash 1 Link to comment Share on other sites More sharing options...
alsheron Posted January 22, 2012 Share Posted January 22, 2012 Well it doesn't look like anyone reads these forums lol. But I resolved the issue...as simple as relative links missing a forward slash Hi, I'm having almost this exact same problem and also the problem with either no replies on the forum or very few. Please can you give me a bit more detail on how you fixed this issue? I thought it was related to Javascript? Can .htaccess make links appear different on hover to how they are in the source? It's ok - looks like I figured it out from what you said. Many Thanks for posting back that you had an answer. Shame the forum seems so empty of community spirit sometimes :-( You saved the day for me :-) Link to comment Share on other sites More sharing options...
Arkadia Posted January 22, 2012 Author Share Posted January 22, 2012 Hi Alsheron, Yeah really sad that this forum is so inactive. I took a shot in the dark posting here, glad it helped you! Awesome! Happy Coding! 1 Link to comment Share on other sites More sharing options...
S.Kinio Posted February 29, 2012 Share Posted February 29, 2012 I share the solution found as i good rimember on this forum. You’ll need to change “content” in “^content/” in the .htaccess file to another word and then change “content/” in the getCMSLink() function in classes/Link.php to match. 1 Link to comment Share on other sites More sharing options...
subulica Posted March 29, 2012 Share Posted March 29, 2012 Well it doesn't look like anyone reads these forums lol. But I resolved the issue...as simple as relative links missing a forward slash and how you have done with that ? where i have to put the "slas / " Link to comment Share on other sites More sharing options...
chetwyn Posted March 30, 2012 Share Posted March 30, 2012 This works for me... I also only have one language active. {$link->getCMSLink(7, 'return-guarantee')} Whole example: <li><a href="{$link->getCMSLink(7, 'return-guarantee')}">{l s='Return Guarantee' mod='tmfooterlinks'}</a></li> 1 Link to comment Share on other sites More sharing options...
mesotek Posted December 3, 2015 Share Posted December 3, 2015 (edited) "You’ll need to change “content” in “^content/” in the .htaccess file to another word and then change “content/” in the getCMSLink() function in classes/Link.php to match." I am new to Prestashop, could you please mention the code here that how to write in .htaccess , also i couldn't find getCMSLink() function in classes/Link.php My Prestashop version is 1.6.1.3 Edited December 3, 2015 by mesotek (see edit history) Link to comment Share on other sites More sharing options...
Seirios Posted December 3, 2015 Share Posted December 3, 2015 Thanks for the tip guys! Link to comment Share on other sites More sharing options...
pepperoni Posted February 2, 2017 Share Posted February 2, 2017 Hey guys, how did you get it done? I'm trying to remove the content/ from all cms pages and leave the .html at the end. So for example to have /delivery.html In Route to CMS page I have tried {rewrite}.html but it goes to a 404 pageI have tried just {rewrite} and it works! Also with {rewrite}.php works. Why is it not working with .html ? I have also tried to use a htaccess rewriterule. So I left it as {rewrite} , which it works, and in my htaccess I have:RewriteEngine OnRewriteRule ^delivery\.html /delivery [L,QSA,NC,P] Still getting the 404 page. Funny thing is if I remove the ssl from all pages the htaccess rewrite rule works! But I do need https on all pages really. So strange. If anyone has a solution please post here. thanks Link to comment Share on other sites More sharing options...
rocky Posted February 9, 2017 Share Posted February 9, 2017 It's probably because .html is used for the product URLs. That's why PrestaShop uses /content/ to distinguish the CMS URLs from the product URLs. You can try temporarily changing the product URL to use something other than .html to see if that's the problem. 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