textpattern icon indicating copy to clipboard operation
textpattern copied to clipboard

Access to \default section and duplicate URLs

Open cara-tm opened this issue 3 years ago • 7 comments
trafficstars

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?

cara-tm avatar Feb 05 '22 08:02 cara-tm

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?

bloatware avatar Feb 05 '22 10:02 bloatware

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.

petecooper avatar Feb 05 '22 15:02 petecooper

@bloatware:

Because the "Screaming Frog SEO Spider" tool always sniff that only URL when I verify my websites despite my canonical link.

cara-tm avatar Feb 05 '22 17:02 cara-tm

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.

bloatware avatar Feb 07 '22 12:02 bloatware

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.

cara-tm avatar Feb 10 '22 16:02 cara-tm

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?

bloatware avatar Feb 11 '22 16:02 bloatware

... 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>

cara-tm avatar Feb 12 '22 08:02 cara-tm