Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2021-02-08 19:11:19
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Redirect a non-existant "section" URL to an article URL
I tried to rediect a non-existant section URL to and article
talonbooks.com/OAHOY to https://talonbooks.com/audio/OAHOY
RewriteCond %{HTTP_HOST} ^talonbooks\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.talonbooks\.com$
RewriteRule ^OAHOY$ "https\:\/\/talonbooks\.com\/audio\/OAHOY" [R=302,L]
404 came up and I couldn’t figure it out, after many versions I failed.
I could only create a kludge by creating a section called OAHOY then writing code to display an article
https://talonbooks.com/OAHOY/OAHOY
Is there no easier way to create redirects (rewrites) for top level URLs like https://talonbooks.com/OAHOY without creating a section named OAHOY?
Thanks
Les
Offline
Re: Redirect a non-existant "section" URL to an article URL
That should work. Maybe you just need to simplify your rewrite? You might be able to get away with:
Redirect 302 /OAHOY https://talonbooks.com/audio/OAHOY
or
RewriteRule ^OAHOY/?$ /audio/OAHOY [L,R=302]
Alternatively, you could not use .htaccess
and try either arc_redirect (straight URL redirects) or smd_redirect (with regex and ordering of rules).
TXP Builders – finely-crafted code, design and txp
Offline