Jump to content

Link to static page.


violinman

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by violinman
Link to comment
Share on other sites

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!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...