Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Redirect .htaccess magic
I recently moved a Textpattern site to a new host and a new domain name. There were a variety of problems with the original host, one of them being that clean URLs were disabled because the server was set up to ignore any .htaccess files in the document root, and the server administrator was unwilling to make any changes, and anyway he was providing the hosting service for free.
Since the service was free, the original TXP site is still active, and I cannot use a proper 301 .htaccess directive to redirect all traffic to the new site. Instead, I edited the page template to use the old-school META REFRESH redirect, like so:
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>My title</title>
<meta name="robots" content="noindex"/>
<meta http-equiv="refresh" content="0;url=http://newdomain.tld<txp:page_url type="request_uri" />"/>
<script>
window.top.location = 'http://newdomain.tld<txp:page_url type="request_uri" />';
</script>
</head>
</html>
By grabbing the request_uri
, Textpattern intelligently redirects URLs on the old site to the same documents on the new site. Peachy!
Here’s the problem: The old site used ?=messy
URLs, so the forwarded request_uri
s are in messy format. The new site uses clean URLs. Is there any way to rewrite the forwarded URLs to match the clean URL structure of the new site? I’m thinking that there might be some way to do this within the new site’s .htaccess file.
Offline
Re: Redirect .htaccess magic
Hi John
I think that installing zem_redirect might do it for you.
Edit: especially if the article id is included in the url
Last edited by colak (2011-02-08 16:21:07)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Redirect .htaccess magic
Thanks, Colak! I have the plugin, but I’m not sure how to use it. I note that the documentation is for subscribers only, and Zem doesn’t accept new subscribers. Can you tell me the basics?
Offline
Re: Redirect .htaccess magic
You might try reading through this thread: http://forum.textpattern.com/viewtopic.php?id=23552
I was one of the original subscribers but, even though I can still log in, I can’t download a copy or access the original documentation.
Offline
Re: Redirect .htaccess magic
John,
you can try rah_metas, that has built-in messy-to-clean redirection.
And, if I were you, I’ll go an step beyond.
1) change DNS records for old site to point to the new server.
2) Thus, when someone requests olddomain.tld, the request arrive to the new server.
3) Then, there, in the new server, you could set the oldserver.tld domain as an alias for the newserver.tld domain
4) Finally, by using a simple, common, old school .htaccess trick, you externally rewrite or redirect the requests from oldserver.tld to newserver.tld.
5) rah_metas takes care of the rest (messy to clean redirection).
Some gains: speedier than a META redirect, and you keep the olddomain.tld tied to the new client’s server (so, easier to do any other management task)…
Hope that helps.
Offline
#6 2011-02-09 19:53:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Redirect .htaccess magic
johnstephens wrote:
I have the plugin, but I’m not sure how to use it. I note that the documentation is for subscribers only, and Zem doesn’t accept new subscribers.
And even old subscribers only had access to the docs for one year (and cannot re-subscribe)…
If I’m not mistaken, when you switch from one permanent link mode to another, just having the plugin installed and activated will redirect the old URLs to the new ones.
Last edited by els (2011-02-09 19:54:01)
Offline
Re: Redirect .htaccess magic
I have the plugin, but I’m not sure how to use it. I note that the documentation is for subscribers only, and Zem doesn’t accept new subscribers.
Yes, it’s frustrating. I wrote down one or two things I found out in this thread and this post and here you can find the download address.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Redirect .htaccess magic
johnstephens wrote:
Thanks, Colak! I have the plugin, but I’m not sure how to use it. I note that the documentation is for subscribers only, and Zem doesn’t accept new subscribers. Can you tell me the basics?
Hi John
I have no access to the docs either but (for my install at least), the plugin just redirects all messy urls to the chosen /id/title schema.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Redirect .htaccess magic
colak wrote:
…the plugin just redirects all messy urls to the chosen /id/title schema.
Els wrote:
…just having the plugin installed and activated will redirect the old URLs to the new ones.
Indeed it does! Thank you!
And thanks also to the rest of you for your insights.
@Maniqui: I wish I could follow your recommendations. Trouble is, the old site was hosted on a subdomain of a domain owned and used by the hosting provider, and the host is not inclined to offer any kind of support, whether by altering the DNS records or otherwise.
Offline
Pages: 1