Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
404 Not Working!
Hi, I have my 404 set up and so when you visit a page like example.com/aboutsssss it will then show the 404 right
BUT if I was to go to example.com/about/ssss it would show the about page? why won’t it show the 404 page??? x
~ Cameron
Offline
Re: 404 Not Working!
Perhaps you’ve got an article titled ‘ssss’ in the about section and are using the title/section url scheme?
Offline
Re: 404 Not Working!
I haven’t got an article called that! Plus it happens with anything that i try as an extension to the about section or other sections.
Here is an example: http://www.simplecandy.com/about/mynameisruud
right I haven’t got an article called mynameisruud in my about section, so why is it showing the about section? why isn’t it showing my 404 page :S
Last edited by driz (2008-09-13 23:05:43)
~ Cameron
Offline
#4 2008-09-14 00:11:26
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: 404 Not Working!
I’m seeing a similar thing. My clean URL scheme is section/id/title. If I start at a single article page & do some tests:
- valid_section/valid_id/valid_title = article page displayed OK
- invalid_section/valid_id/valid_title = 404 page
- valid_section/invalid_id/valid_title = 404 page
- valid_section/valid_id/invalid_title = same article page displayed!!
Offline
Re: 404 Not Working!
So is this a Textpattern bug that no one has noticed until now? :S
Or is just WE haven’t done something correct on our sites? x
~ Cameron
Offline
#6 2008-09-14 01:04:34
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: 404 Not Working!
driz wrote:
So is this a Textpattern bug that no one has noticed until now? :S
Or is just WE haven’t done something correct on our sites? x
Don’t know – but on reflection, in my case, I’m not sure altering the behaviour would be beneficial. The reason I chose the “section/id/title” URL mode was because many articles on my website were going to have identical titles. The article id is the bit that’s cast in stone, whereas the title might change.
Offline
#7 2008-09-14 01:10:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: 404 Not Working!
If you don’t have a <txp:article />
tag on your about page, or only in <txp:if_article_list>
tags, it will never display an individual article.
Offline
Re: 404 Not Working!
Els wrote:
If you don’t have a
<txp:article />
tag on your about page, or only in<txp:if_article_list>
tags, it will never display an individual article.
Yes, but that’s not the point I’m making, I’m saying why isn’t Textpattern saying 404 when i’m requesting something that doesn’t even exist whatsoever in any form in any section or in any article. x
~ Cameron
Offline
Re: 404 Not Working!
It’s known fact that dynamically created clean URLs always open these kind of “bugs”, not just in Textpattern but everywhere. Clean URLs are “expecting” that the content is there, but they never know is it really there.
Ofcourse it can be safe checked again and again, like in the section/id/title scheme the title could be checked, but there are some minus points against that check. In example speed loss: it would require one extra query, together it makes three of them; section, id and article.
Atleast TXP doesn’t have clean URL security holes that is too common in the CMS business, because of some ppl write code with out knowing what it exactly does: in example some ppl trust the URL parsing and modrewrite too much.
This is also one minus point against sub sections: those are easy to do, small thing actually, but there are the same minus points x 2.
Last edited by Gocom (2008-09-14 01:52:18)
Offline
Re: 404 Not Working!
Umm so what’s the fix? If a user goes to example.com/about/somerandomtext then they arn’t going to be told that its a 404 rather the’re going to end up on the about page, making things messy! WordPress doesn’t do this?
~ Cameron
Offline
Re: 404 Not Working!
By the way I just visited hickdesign.co.uk and no matter what section your in, you can random url and it will throw up the 404!
Soooo he obviously has done something different :S
ie. http://hicksdesign.co.uk/extras/gty
How come the extras page isnt showing up and trying to display the gty article? how has he got it to show a 404
Last edited by driz (2008-09-14 02:05:04)
~ Cameron
Offline
Re: 404 Not Working!
zem_redirect redirects some URLs to correct locations, rah_metas can redirect messys to clean.
The fix to custom problems depends on what URL scheme you use, but at the same time, it will make your pages slower.
In example you could parse the url in example with PHP’s parse_url
or use Textpattern’s page_url()
, and check the last node against url_title stored inside textpattern-table.
Something like this in example, (not tested so don’t expect it to work in anyway):
$page_url = trim(page_url(array()),'/');
$url = explode('/',$page_url);
if(count($url) > 1 && category(array()) == '' && section(array()) == $url[0]) {
if(safe_count('textpattern',"url_title='".doSlash($url[1])."'") == 0) header('Location: '.hu.$url[0]);
}
driz wrote:
How come the extras page isnt showing up and trying to display the gty article? how has he got it to show a 404
Depends on URL scheme. Most safest schemes are /title/ and /section/title/. Those usually return 404 page correctly (depends on server thought). So it can be server issue in your case.
Last edited by Gocom (2008-09-14 02:16:18)
Offline