textpattern
textpattern copied to clipboard
Access to \default section and duplicate URLs
Is your feature request related to a problem?
Not really: subject to Devs appreciation.
What is the feature?
Try to access from /default URL from your domain name.
Maybe the .htaccess file could include such a protection?
Sorry, what's wrong specifically with /default/ URL? One has the same duplicate URL problem with, say, /articles/ and /articles/index.php, or /articles/?a=b. Isn't adding a canonical link to the page template a better way solve it?
Isn't adding a canonical link to the page template a better way solve it?
^^ This. If /?s=default is accessed, it shows the front page, as expected. If /default/ is accessed, that also shows the front page.
@bloatware:
Because the "Screaming Frog SEO Spider" tool always sniff that only URL when I verify my websites despite my canonical link.
I'd say it's a Screaming Frog SEO Spider issue, but you certainly can add a rule to your .htaccess. Unsure about the general case, though. For example, redirecting /default to / would forbid default as article URL title.
Okay. I found the reason:
I'm using this tag for some fake anchor on links <a href="<txp:page_url type="s" />#up" ...
and the source code shows /default as current page for my root domain.
Yep, it looks like 'default' is what $pretext['s'] (used by <txp:page_url type="s" />) contains on home pages. Should it be empty instead? Probably, but how to do it in a bwc way?
... I don't know how...
For your interest, I added this on the top of my default page:
<txp:evaluate query='contains("<txp:page_url value="default" />", "default")'><txp:header name="Location" value='<txp:site_url />' /></txp:evaluate>