Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2004-10-13 05:40:27

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

Re: [plugin] [ORPHAN] zem_redirect

Hafnius,

You can (and should) handle that with a regular .htaccess ErrorDocument.

The plugin can’t do it because it has no way to intercept errors – it can only handle those generated by the plugin itself. (Which I think explains Compooter’s query above – the plugin can’t act as an ErrorDoc handler for things that occur outside of Texpattern, such as a missing section file)


Alex

Offline

#26 2004-10-13 14:01:57

hafnius
Archived Plugin Author
From: DK
Registered: 2004-09-02
Posts: 47

Re: [plugin] [ORPHAN] zem_redirect

Aahhh I see – thanks for the clarification.


– Nobody puts Baby in the corner !
Johnny Castle, Dirty Dancing

Offline

#27 2004-10-31 04:00:28

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: [plugin] [ORPHAN] zem_redirect

zem – I think this plugin is redirecting http://station11.net/log/234/#comment to http://station11.net/log/234/photos-from-france. Has anyone else noticed this? I could just be misinterpreting the comments_invite function and passing it the wrong variables.

<code>[kjell@imac:~] % curl -I http://station11.net/log/234/#comment
HTTP/1.1 301 Moved Permanently
Date: Sun, 31 Oct 2004 03:54:04 GMT
Server: Apache
X-Powered-By: PHP/4.3.8, The blood, sweat and tears of the fine, fine TextDrive staff
Location: http://station11.net/log/234/photos-from-france
Vary: Accept-Encoding
Served-By: TextDrive
Connection: close
Content-Type: text/html; charset=UTF-8</code>

There’s the pages information, and here is how the part of my plugin which generates the comments link looks like: $comments = comments_invite($AnnotateInvite,$Section,$ID);. My fault or the plugins?

Last edited by misterk (2004-10-31 04:01:14)

Offline

#28 2004-10-31 09:58:06

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

Re: [plugin] [ORPHAN] zem_redirect

A web browser shouldn’t send the ‘#comment’ part in the GET request, though some might under certain circumstances. Have you seen this happen with a browser?


Alex

Offline

#29 2004-10-31 17:12:34

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: [plugin] [ORPHAN] zem_redirect

I don’t think it is… it’s in the url, as an identifier. A 301 is returned, and php redirects the page to /title. I don’t see where anything is in a get, but when you load it in a browser you just get redirected just like curl says.

Offline

#30 2004-10-31 21:49:51

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

Re: [plugin] [ORPHAN] zem_redirect

Oh, right, I misread the URL. The web browser requests ‘http://station11.net/log/234/’, and the plugin redirects it to ‘http://station11.net/log/234/photos-from-france’. Firefox handles this correctly, and tacks ‘#comment’ on the end of the new URL; IE doesn’t.

The ‘#comment’ part normally isn’t sent to the server, so the plugin doesn’t have an opportunity to do anything about it.

As of 1999, only about one third of Web browsers re-applies the fragment identifier to the redirected URL.

A quick google suggests this is an open problem.


Alex

Offline

#31 2004-10-31 21:57:06

misterk
Member
From: Morris, MN
Registered: 2004-02-24
Posts: 77
Website

Re: [plugin] [ORPHAN] zem_redirect

Ok, so maybe I should try and play with the comment_invite function to request …/#/title#comment. Thanks!

Offline

#32 2005-02-01 05:08:08

txfrog1999
Archived Plugin Author
From: Texas
Registered: 2004-12-31
Posts: 17
Website

Re: [plugin] [ORPHAN] zem_redirect

zem – great plugin, works wonders when using your rewrite plugin on servers less than enthusiastic about giving me access to rewrite rules in the .htaccess file. I did want to mention that in one of the sites I worked on over the weekend with text pattern and your plugin, I needed to redirect to a page upon an error and not an article ID, since all articles in this case were magazine descriptions.

So, the solution was to add an attribute to your plugin: errorpage=“x”

after line 7 I added the following line:

$errorpage = (!empty($atts[“errorpage”]) ? $atts[“errorpage”] : “”);

and made the following changes to the conditional if($notfound) on line 39:

if ($notfound) { header(“HTTP/1.1 404 Not Found”); if ($errorid) { $pretext[“id”] = $errorid; $zem_redirect_lock = 1; textpattern(); exit; } else if ($errorpage) { header(“location:http://”.$canonical_host.”/”.$errorpage); exit; } else print “The requested page ‘$actual_uri’ does not exist.”; exit;
}

So upon using the plugin I now have the tag read: <txp:zem_redirect ignoredomain=1 errorpage=“404”> In this case 404 equals a custom section I created to handle all errors, but you could just as easily have put errorpage=“error.php”.

Offline

#33 2005-02-04 08:58:30

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: [plugin] [ORPHAN] zem_redirect

zem_redirect comflicts with the hfw_pg_* plugin used to generate paginated articles.

Last edited by Etz Haim (2005-05-18 06:35:14)

Offline

#34 2005-02-05 04:12:27

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: [plugin] [ORPHAN] zem_redirect

I have produced a hacked version of zem_redirect that enables it to work fine with paginated articles. The demonstration URL is now working. I’m sending the hack to zem.

PS. Once my website becomes production, this demo URL will be removed.

Update: My hack also has a condition to trim the redundant ?pg=1 suffix.

Last edited by Etz Haim (2005-02-05 04:31:19)

Offline

#35 2005-02-10 10:16:36

Vincent Grouls
Archived Plugin Author
From: Aberdeen, UK
Registered: 2005-01-31
Posts: 9
Website

Re: [plugin] [ORPHAN] zem_redirect

This is a great plug-in zem, thanks!

zem_redirect also conflicts with the ‘fla_style_switcher’ by Benoit Pepermans. In case you wish to use both, just add this to the code of zem_redirect:

FIND:
<pre><code> $actual_host = serverSet(“SERVER_NAME”); $actual_uri = urldecode(serverSet(“REQUEST_URI”)); $notfound = 0;
</code></pre>

AFTER, ADD:
<pre><code> if(gps(‘css’)) { return; }
</code></pre>

Last edited by Vincent Grouls (2005-02-10 10:17:34)

Offline

#36 2005-05-03 18:12:31

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: [plugin] [ORPHAN] zem_redirect

This still looks up the url_mode variable, right? Perhaps it’s time to update it to use permlink_mode.

Offline

Board footer

Powered by FluxBB