Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hello, everyone!

I have the problem with custom 404 page. I spent much time and felt crazy with it.
Normally, when we search non-exist links and it has shown by default as "Page not found" phrase in the white page.
I'd like to create more beautiful error page than that.
I started to follow the couch doc by creating 404.php in root folder, then uncomment #ErrorDocument 404 /404.php in .htaccess file generated from gen_htaccess. Anyway, it has not fully worked. When I started to browse the non-exist link, e.g http://www.example.com/non, the error page has shown only the page without loading the style (html without css). I have no idea with that.
Second, if I browse the non-exist link with any word after .php/, e.g. http://www.example.com/contact.php/something, the page was shown the original html contents of contact.php without loading css style.

I do not want those.
What I want is,
http://www.example.com/non
http://www.example.com/contact.php/something
showing the 404 error page, when I browse those links.

Another question with SEO url links,
I do not want this URL http://www.example.com/about.php, but http://www.example.com/about
How can I create SEO link like that?

I am going crazy with those. please kindly help as soon as possible.
Thank you in advance. :( :( :( :( :(

Attachments

Hi,
Anyway, it has not fully worked. When I started to browse the non-exist link, e.g http://www.example.com/non, the error page has shown only the page without loading the style (html without css).

Please check the CSS links within your custom 404 file - what you see happens if the links are 'relative'. Please convert them to 'absolute' to rectify this problem.
For example, a link such as the follows
Code: Select all
<link href="css/lightbox.css" rel="stylesheet" />

should be made either the following (notice the added leading slash)
Code: Select all
<link href="/css/lightbox.css" rel="stylesheet" />

or, better still, the following
Code: Select all
<link href="<cms:show k_site_link />css/lightbox.css" rel="stylesheet" />

if I browse the non-exist link with any word after .php/, e.g. http://www.example.com/contact.php/something, the page was shown the original html contents of contact.php without loading css style.
Adding anything like that after the template name ('contact.php' in this case) is a valid method of passing information to PHP scripts (like using querystring parameters e,.g http://www.example.com/contact.php?something).

To be precise, what you are passing is considered to be 'PATH_INFO' that is used by the web-server to translate the path of the document. I think you can see why the CSS styling disappears; the PATH_INFO will make the server search for the css files at the modified (but wrong) path.

Another question with SEO url links,
I do not want this URL http://www.example.com/about.php, but http://www.example.com/about
How can I create SEO link like that?

You may use 'prettyURLs' - please see http://docs.couchcms.com/concepts/pretty-urls.html

Hope it helps.
Thank you very much for your reply.
I got great help. I have already done it :) :) :) :) :)
3 posts Page 1 of 1
cron