violinman Posted June 18, 2017 Share Posted June 18, 2017 Good morning, I have added a page to documents in order to link to an outside static page and have added the URL to the outside page and selected open URL in new window. The URL I have added is /test/test.html so that it is relative to CubeCart or should it have the full URL with domain name ? Anyway it does not work either way, when I call the document it is shown rather than the static page it should link to! Any suggestions please. Brian Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 18, 2017 Share Posted June 18, 2017 I have a document that links to an outside page. This is in the document's URL setting in Admin, and it links properly. https://www.facebook.com/groups/plushmemories/ Quote Link to comment Share on other sites More sharing options...
violinman Posted June 18, 2017 Author Share Posted June 18, 2017 Thanks for your reply, I did try the full URL but no luck, the page I am linking to is on the same server and domain name. Does the Custom SEO URL Path need to be the same as the static page name? Thank you. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 18, 2017 Share Posted June 18, 2017 I don't use the static page name as the SEO URL. I'm guessing that it means you have to use the up and down from root style url, since yours is on the same domain. @bsmither has shown how to do that several times on the forum - I'll try to find one for you. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 18, 2017 Author Share Posted June 18, 2017 Now I am baffled! up and down from root style? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 18, 2017 Share Posted June 18, 2017 I can't find what I was trying to describe. And that's just my expression for it. I'll keep looking. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 18, 2017 Author Share Posted June 18, 2017 Could you give me an example perhaps? Brian Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 18, 2017 Share Posted June 18, 2017 It's something about designating the file placement by showing slashes with something to go down to the root and then some slashes to go back to the level of the file. I know that's horribly vague, but it's what popped into my head as soon as I read your problem - he explains it somewhere. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 18, 2017 Share Posted June 18, 2017 Did you try leaving off the initial slash? https://stackoverflow.com/questions/5559578/having-links-relative-to-root PS: I did find an example of what I remembered, but it's not from this forum, and it's total gobbledygook to me: echo realpath('./../../etc/passwd') . PHP_EOL; http://php.net/manual/en/function.realpath.php Quote Link to comment Share on other sites More sharing options...
violinman Posted June 18, 2017 Author Share Posted June 18, 2017 (edited) I think we probably have to wait for bsmither! I tried leaving off the first slash, then putting in the complete URL with the domain, I have not tried adding a trailing slash after the file name. Maybe I will try an entirely different domain. If that does not work it can only be a CubeCart or cache problem. Every time Cube Cart shows the dynamic document that has the link rather than the linked static page. Very frustrating! Edited June 18, 2017 by violinman Quote Link to comment Share on other sites More sharing options...
ayz1 Posted June 18, 2017 Share Posted June 18, 2017 (edited) Is this any help? https://forums.cubecart.com/topic/51262-link-to-static-page-fails/#comment-217644 Edited June 18, 2017 by ayz1 Quote Link to comment Share on other sites More sharing options...
violinman Posted June 18, 2017 Author Share Posted June 18, 2017 Hi Ayz1, I have seen that post but I have the URL, page name etc.. correct but it is still not working as it should. In fact having spent many hours on it I am now just using a 301 redirect from the dynamic page to the static page which of course works just fine! Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 18, 2017 Share Posted June 18, 2017 The code in CC6 allows for a document to be created, and most of the parameters are ignored if it has a Document URL. (The title is still needed.) This document is an actual file that exists somewhere. Also, if the file is on your site, the .htaccess rewrite code must be able to find that file. This part of the re-write code: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)\.html?$ index.php?seo_path=$1 [L,QSA] The first directive says to only do the rewrite if the filename requested is not where it is supposed to be, that is, not found. So, if test.html actually exists in the /test/ folder, this directive will evaluate to false, the rewrite will not happen, and the web server will find and respond with the document at /test/test.html. Now, as with any URL, there are complete, absolute, and relative styles. Your browser will figure out how to deal with this. So, make sure the web server is behaving appropriately as regards the conditions and rules for rewriting URLs. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 19, 2017 Author Share Posted June 19, 2017 Hello Brian, many thanks for that. out of desperation I had already set up a 301 redirect which is working fine. Would there be any advantage in changing it to the RewriteRule that you suggest? I appreciate you taking the time to reply. Quote Link to comment Share on other sites More sharing options...
violinman Posted June 24, 2017 Author Share Posted June 24, 2017 Hello bsmither, would you mind showing me the re-write code again but with my example /test/test.html in place in your example ? I always struggle with the layout of of the RewriteRule, it is a bit like Swahili to me. Much appreciated, Brian Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 24, 2017 Share Posted June 24, 2017 The re-write code I posted earlier is the standard .htaccess code CubeCart needs for any seo-friendly URL to be calculated. What we want you to do is make sure that code (exactly as seen above) is in your .htaccess file. (There is more than just that in the file, but all those directives above must be present.) Then, as for the /test/test.html file, make sure that it is actually a real file located in a real sub-directory, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.