Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#76 2005-01-09 12:30:13

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

At the moment I have old-style URLs with IDs in them. I plan to use the plugin to get rid of the IDs, is there a way to collectively redirect calls to old-style URLs?

I.e. I don’t want to write a permanent redirect rule for each of my 60+ articles. Unfortunately, I don’t know regexps, which are probably a solution.

Any hints or solutions are greatly appreciated!

Thanks.

Offline

#77 2005-01-09 14:06:09

jjeff
Member
From: Massachusettes, USA
Registered: 2005-01-03
Posts: 11
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

> jjeff wrote:

> Do I need to modify the templates in order to use zem_rewrite?

> I know that I need to change permalinks and stuff, but I thought I saw something somewhere about needing to add a line at the top of my templates. I can’t seem to find anything about that in the documentation though.

> If so, what is the line I need to add?

Hi Zem,

In this post you say to

Just plonk the tag at the top of your article page, and it’ll do the rest. It must be the very first tag on the page, before the doctype.

What is the tag that needs to be added? There doesn’t seem a subroutine in the plugin for a txp:zem_rewrite tag. And there’s nothing about this in the documentation.

-Jeff

Offline

#78 2005-01-09 22:56:49

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Jeff,

Those instructions are for the zem_redirect plugin, not zem_rewrite.


Alex

Offline

#79 2005-01-10 00:20:08

jjeff
Member
From: Massachusettes, USA
Registered: 2005-01-03
Posts: 11
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Ha ha… You mean I need to read the ENTIRE words? :-)

Doh! Now everyone on the Internet is going to think I’m an idiot.

-j

Offline

#80 2005-01-10 14:49:46

andreas
Member
Registered: 2004-02-28
Posts: 453
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem, if I use your plugin, can there be other statements in the .htmaccess file like redirects?

Is there a regexp statement to redirect URLs like this one:

http://www.rete-mirabile.net/lernen/54/this-is-the-title

to this pattern:

http://www.rete-mirabile.net/lernen/this-is-the-title

? If so, how would the redirect rule look like?

Thanks.

Offline

#81 2005-01-10 17:13:04

lwray
Member
From: Allston, MA
Registered: 2004-12-02
Posts: 21
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem -
I’ve been struggling to install this plugin for some hours now. I’ve tried putting the respective rewrite statements in the .htaccess file at my website root and, when that didn’t work, in the httpd.conf file. I’ve tried deleting the section placeholders and the .htaccess directives that come with the Textpattern clean URLs. The best I was able to get was an index page with every document redirecting to the index page. At worst, I disabled everything else on my webserver, including Textpattern.

Is it possible to get your plugin to do what I’d like? Basically, I want it to make my entries appear at

/journal/this-is-the-title
/journal/199/

I want these to also redirect to the first address:

/2004/12/this-is-the-title (from back when I used to use Blogger)
/journal/199/this-is-the-title

but I am willing to make rewrite rules to do that independent of your plugin.

All of my entries have url-titles, so according to your directions this should work. I’m left with the thought that perhaps something is wrong in my Apache configuration – should I have something in particular enabled that I might not?

Thanks a lot.

Last edited by lwray (2005-01-10 17:53:27)

Offline

#82 2005-01-10 17:50:59

TheEric
Plugin Author
From: Colorado & Montana.
Registered: 2004-09-17
Posts: 603
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

I noticed upon using this plugin that I had to edit taghandlers.php near the search_input form so that the built in search would work. (going from memory here) The edit was to remove the index.php at $scn’“index.php” . Without this edit, I kept receiving an error stating that index.phpq=searchTerm could not be found.

Offline

#83 2005-01-12 17:22:04

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

The new version of this plugin (0.5) says that a new simple 404 handler has been added. Anyone know how to get this to work? I’m just getting a message that says “no page template specified for section xyz”.

Offline

#84 2005-01-13 21:49:09

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

There’s a new version available for download. No new features, but it fixes a few bugs.


Alex

Offline

#85 2005-01-15 01:52:06

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem, I hate to keep complaining, but I’m still having escaping issues. the zem_permlink tag is generating URLs with the slashes escaped as ‘%2F’, which breaks everything.

update: Fiddling with the various bits which call url_encode doesn’t seem to be helping, either, so I’m not sure what the problem is exactly.

updated again: I’ve got it working now, with the following edit. In the function zem_format_url, I’ve changed the line return $pfr.$uri; to return urldecode($pfr.$uri); and it seems to be working fine.

Last edited by ubernostrum (2005-01-15 01:59:00)


You cooin’ with my bird?

Offline

#86 2005-01-15 01:56:35

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Wilshire,

The zem_rewrite 404 handler only deals with URLs that don’t match a defined scheme.


Alex

Offline

#87 2005-01-15 02:01:25

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Ubernostrum,

I can’t reproduce the %2F issue here. Can you show me a URL that demonstrates the problem?


Alex

Offline

#88 2005-01-15 02:03:34

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Using urldecode() in zem_format_url will break if you have categories with spaces or other unusual characters.


Alex

Offline

#89 2005-01-15 02:09:01

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

zem, unfortunately I don’t have a live URL; my test server runs on a local machine here and isn’t publicly accessible. I can describe the setup, though, if that’ll help. In zem_rewrite I’ve got the following URL schemes in the following order:

$uri_scheme['weblog'] = '{section}/{date}/{article}/{title}';
$uri_scheme['article_urltitle'] = '{section}/{url_title}/';
$uri_scheme['category'] = '{section}/{category}/';
$uri_scheme['article_alt'] = '{section}/{article}/';
$uri_scheme['section'] = '{section}/';

Then I’ve got a ‘weblog_article’ form which has this:

<h2><txp:zem_permlink scheme="weblog"><txp:title /></txp:zem_permlink></h2>

What I’m getting from that is the following (actual URL it’s generating):

<h2><a href="/weblog/2005%2F01%2F06/9/blah-blah-update">Blah blah update.</a></h2>

Instead of

<h2><a href="/weblog/2005/01/06/9/blah-blah-update">Blah blah update.</a></h2>

And I know urldecode will break on some stuff, but thankfully I don’t use any funky category or section names ;)

Last edited by ubernostrum (2005-01-15 02:11:29)


You cooin’ with my bird?

Offline

#90 2005-01-15 02:28:47

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: [plugin] [ORPHAN] zem_rewrite: configurable clean URLs

Ah, I see now.

Here’s a change that should fix it, I think. In zem_format_url, replace this:

$uri = str_replace('{'.$k.'}', urlencode($v), $uri);

with this:

$uri = str_replace('{'.$k.'}', ($k == 'date' ? $v : urlencode($v)), $uri);


Alex

Offline

Board footer

Powered by FluxBB