Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#151 2005-06-19 06:22:48

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

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Lovely! That’ll be a lot to try out! Thanks sgb!

Offline

#152 2005-06-19 11:45:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

sungodbiff wrote:
<br />
Error Handling
To get the most out of the error handling make sure you update sgb_error_documents to version 0.1.2 or higher. sgb_url_handler now supports issuing 301 Permanently Moved headers when <code>$config[‘send_301’]</code> is set to true (it’s false by default).
<br />
sgb_url_handler will look at the scheme matched and compare it to the scheme defined for that section (or the permlink mode defined in TxP’s admin) — if the schemes are different than the user is 301-ed to the correct scheme.
<br />
If you’re running a site with send_301 enabled, you’ll want to change <code>$config[‘match’]</code> to “exact”, since you won’t really be handling “best” fits any more.

I must be missing something.
In Admin > Preferences permanent link mode is set to /section/title.
I updated and activated both plugins.
In sgb_error_documents the only thing I changed is this:
<code>

// 404 File Not Found $r[‘error_documents’][‘404’][‘id’] = 242;

</code>
In sgb_url_handler:
<code>

// Defines which mode to match $config[‘match’] = ‘exact’;

// Send 301 redirects? $config[‘send_301’] = 1; // bool

// Send 404 not founds? $config[‘send_404’] = 1; // bool

</code>

What I thought would happen, is this:

1. requested url /section/id/title will be sent to section/title
2. requested non-existing url will be sent to article 242

But:
1. requested url /section/id/title is giving the correct article, but not showing the correct url (still showing /section/id/title instead of /section/title)
2. requested non-existing url is sent to the home page

I’m sure there’s something I’m misunderstanding about this plugin, now if I only knew what…

Offline

#153 2005-06-19 16:05:18

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

doggiez -

You’re right it should work as you described. It worked for me so let me poke around a bit. Make sure you’re using sgb_error_documents 0.1.2 as 0.1.1 does not support 301s.

- sgb

Offline

#154 2005-06-19 16:27:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

> sungodbiff wrote:

> Make sure you’re using sgb_error_documents 0.1.2 as 0.1.1 does not support 301s.

I’m using sgb_error_documents 0.1.2 and sgb_url_handler 0.1.8, just downloaded them today.
Thanks for poking around.

Offline

#155 2005-06-19 19:37:36

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

doggies -

I updated the links in the first post and on my site. The new version is 0.1.8.1. Please let me know if this fixes the problem you were experiencing.

Thanks,

- sgb

Offline

#156 2005-06-19 20:09:40

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Unfortunately nothing changed. I’m having doubts if it is the plugin, if it’s working for everyone else.

Some examples: (http://www.doggiez.nl/artikel/project-click is the permlink to my article that has id 240.)

http://www.doggiez.nl/artikel/240/project-click is going to the right article, but the url doesn’t change to the one without id.
http://www.doggiez.nl/artikel/138/project-click (existing id, other article) is going to article 138, but the url again doesn’t change.
http://www.doggiez.nl/artikel/5555/project-click (non-existing id) is going to the home page.
(If I de-activate the plugin all go to the home page).

Am I wrong in assuming that the first two would lead to the requested article, but show the url as set in Preferences: /section/title, and that the third one would lead to my Not Found article?

I can call my 404 article that has id 242 (http://www.doggiez.nl/foutje/niet-gevonden), so I know it’s there, but even something like http://www.doggiez.nl/some-really-nonexisting-url takes me to the home page.

Again, it’s probably something outside the plugin (in my mind for instance…)

[Edit]: by the way it was the same with sgb_url_handler 0.1.5 and sgb_error_documents 0.1.1.

Last edited by doggiez (2005-06-19 20:21:59)

Offline

#157 2005-06-19 20:12:10

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

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Out of the box it didn’t work for me either. I installed both new versions (url_handler and error_documents) and called a URL that didn’t match the default scheme. Nothing happened: the article was displayed.

If I call an invalid URL, I’m taken to the section homepage.

Here are my diagnostic details:

<code>
Textpatternversion: 1.0rc3

Schema der URLs: section_title

Seiten-URL: rete-mirabile.net
PHP-Version: 4.3.10
Register globals: 1
Magic quotes: 1/0
Regionale Einstellungen: de_DE.UTF-8
Server: Apache/1.3.26 (Unix) Debian GNU/Linux FrontPage/5.0.2.2623 PHP/4.3.10 mod_ssl/2.8.10 OpenSSL/0.9.7
Apache-Version: Apache/1.3.26 (Unix) Debian GNU/Linux FrontPage/5.0.2.2623 PHP/4.3.10 mod_ssl/2.8.10 OpenSSL/0.9.7
</code>

Offline

#158 2005-06-19 22:39:47

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Hmm. There is something fishy going on. It seems to be working fine on my site.

The real link:
http://mighthitgold.net/journal/sgb_error_documents

A real link (using another scheme):
http://mighthitgold.net/journal/txp/sgb_error_documents
This results in a 301 & redirection to the first link.

An incorrect link:
http://mighthitgold.net/journal/THISISWRONG/sgb_error_documents
This results in a 404.

My sgb_url_handler_config():
<code>// Defines which mode to match</code>
<code>$config[‘match’] = ‘exact’;</code>

<code>// Send 301 redirects?</code>
<code>$config[‘send_301’] = 1; // bool</code>

<code>// Send 404 not founds?</code>
<code>$config[‘send_404’] = 1; // bool</code>

My sgb_error_documents_config():
<code>// 301 Moved Permanently</code>
<code>// Do not change the 301 unless you know what you’re doing!</code>
<code>$r[‘error_documents’][‘301’][‘id’] = null;</code>
<code>$r[‘error_documents’][‘301’][‘url’] = 1;</code>
<code>$r[‘error_documents’][‘301’][‘file’] = null;</code>
<code>$r[‘error_documents’][‘301’][‘text’] = null;</code>

<code>// 403 Forbidden</code>
<code>$r[‘error_documents’][‘403’][‘id’] = null;</code>
<code>$r[‘error_documents’][‘403’][‘url’] = null;</code>
<code>$r[‘error_documents’][‘403’][‘file’] = null;</code>
<code>$r[‘error_documents’][‘403’][‘text’] = null;</code>

<code>// 404 File Not Found</code>
<code>$r[‘error_documents’][‘404’][‘id’] = 40;</code>
<code>$r[‘error_documents’][‘404’][‘url’] = null;</code>
<code>$r[‘error_documents’][‘404’][‘file’] = null;</code>
<code>$r[‘error_documents’][‘404’][‘text’] = null;</code>

But it’s clearly not working properly on your sites. At this point I’m not sure what’s wrong I’ll continue to play around with it and figure out what could be happening.

If you know, could you post which revision of TxP your using e.g. 1.0RC3 r243.

Thanks!

- sgb

Last edited by sungodbiff (2005-06-20 03:12:43)

Offline

#159 2005-06-20 06:11:52

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

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

rev 406 — I don’t have to use the tag provided to get the plugin workin, do I? I just installed the two and made the basic configuration, although for error_docs I didn’t provide any data for the 404s but the 301s should be working anyway, shouldn’t they?

I have it installed on www.rete-mirabile.net

Offline

#160 2005-06-20 15:04:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Mine is rev 406 as well, before that the plugins acted the same, I don’t know which rev it was, got it from deanload in the first week of May I think.

My configs are exactly the same as yours.

In case diagnostics tell you something:

Textpattern version: 1.0rc3
Document root: /home/httpd/vhosts/doggiez.nl/httpdocs
$path_to_site: /home/httpd/vhosts/doggiez.nl/httpdocs
Textpattern path: /home/httpd/vhosts/doggiez.nl/httpdocs/textpattern
Permanent link mode: section_title
open_basedir: .:/home/httpd/vhosts/doggiez.nl:/tmp:/usr/share/pear
upload_tmp_dir: /tmp
Temp folder: /home/httpd/vhosts/doggiez.nl/httpdocs/textpattern/tmp
Site URL: www.doggiez.nl
PHP version: 4.3.11
Register globals: 1
Magic quotes: 1/0
Locale: en_GB.UTF-8
Server: Apache/2.0.46 (Red Hat)
Apache version: Apache/2.0.46 (Red Hat)

.htaccess file contents:
————————————
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php

————————————

Last edited by doggiez (2005-06-20 15:05:56)

Offline

#161 2005-06-21 00:55:54

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

It seems to be a problem with sgb_error_documents and the newer revisions of TxP. I was using a version from March/April.

Working on it now.

Update: Okay, it’s not a problem with sgb_error_documents per se, it’s a problem with how <code>sgb_error_document()</code> is being checked in <code>sgb_url_handler_config()</code>.

- sgb

Last edited by sungodbiff (2005-06-21 01:04:06)

Offline

#162 2005-06-21 01:37:56

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Okay, problem found. I’ll post more in a few minutes after I try a couple of solutions.

- sgb

Offline

#163 2005-06-21 02:48:52

sungodbiff
Archived Plugin Author
Registered: 2004-03-23
Posts: 57
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

doggiez & andreas -

After much trial and error I figured out what was going on. In short, recent versions of TxP executed plugin code differently. Plugin code used to be strung together and <code>eval()</code>‘d at the same time — this meant plugins could reference code in other plugins (as sgb_url_handler and sgb_error_documents do). In recent versions this behavior changed, each plugin is <code>eval()</code>‘d separately — meaning plugins can’t reference code in other plugins. I’m hoping this changes as I’d like sgb_error_documents to be accesible by any and all plugins that want to use it.

And on that note, I don’t want to officially combine the two plugins, so you’ll need to download the newest versions (links are posted in the first post of this tread and on my site): sgb_url_handler 0.1.8.3 and sgb_error_documents 0.1.2.2.

Edit: These instructions are only necessary if your install of TxP lacks the function <code>include_plugin()</code>

1. Install sgb_url_handlers 0.1.8.3
2. Install sgb_error_documents 0.1.2.2
3. Configure each plugin per normal
4. Edit sgb_error_documents and copy all the code (you don’t need to save after copying)
5. Return to the plugins page
6. Edit sgb_url_handler, delete or comment out the line that says <code>include_plugin(‘sgb_error_documents’);</code>
7. Paste all the code you copied from sgb_error_documents above the line you just commented out (or deleted)
8. Save the changes and return to the plugins page
9. Activate sgb_url_handler — you don’t need to activate sgb_error_documents.

It should work now. There were a few misc. changes to both plugins so you’ll want to update to the versions above.

At this point I’m going to keep the plugins separate and see if I can’t get TxP to switch back to the old style plugin deal.

Sorry for the confusion. Let me know if it works for you now.

- sgb

Last edited by sungodbiff (2005-06-22 00:49:37)

Offline

#164 2005-06-21 13:37:01

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

THANK YOU SG!
finally got my 404s to work :*


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#165 2005-06-21 14:28:58

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] sgb_url_handler - support all url variations at the same time

Perfect sgb!!! It’s working! Thank you for all your trouble.

Offline

Board footer

Powered by FluxBB