Page 1 of 1

If you have a tag "admin" s9y goes to admin page.

Posted: Fri Jul 20, 2007 9:08 am
by puck
Hi,

I have a number of blog posts tagged with "admin" if they're general admin posts about my blog. The other day I tried clicking on the "admin" tag to see what posts I had. I was somewhat surprised to be redirect to the admin page for my blog.

To see this try clicking on the "admin" tag on:
http://blog.etc.gen.nz/index.php?/archi ... -blog.html

I have a redirect for the admin page *only* to an HTTPS site, but that shouldn't be getting triggered by the tag page.

This is s9y v1.1, Tagging of Entries v2.88.

Cheers!

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Fri Jul 20, 2007 10:55 am
by garvinhicking
Hi!
I have a redirect for the admin page *only* to an HTTPS site, but that shouldn't be getting triggered by the tag page.
Seems your redirect is wrong and listens to any occurence of "admin" in the URL? :-)

Best regards,
Garvin

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Tue Jul 24, 2007 6:12 am
by puck
Gidday,
garvinhicking wrote:Seems your redirect is wrong and listens to any occurence of "admin" in the URL? :-)
I don't think so. This is my rewrite:

Code: Select all

  RewriteRule ^/serendipity_admin.php(.*) 
      https://blog.etc.gen.nz/serendipity_admin.php$1           [R=301,L]
(All on one line of course)

So I'd be surprised if that is matching the tag...

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Tue Jul 24, 2007 2:21 pm
by garvinhicking
Hi!

Phew. I'm sorry, you'Re right. It is a custom Serendipity rewrite rule, that matches 'admin' too broadly:

/(admin|entries)(/.+)?

would also match your adminPath.

So, you could either try to rename your 'admin' Tags to 'administrative' or you could change the permalink configuration of your s9y installation to change the default 'admin' path permalink to sth like 'blogadmin'.

HTH,
Garvin

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Wed Jul 25, 2007 11:03 pm
by puck
garvinhicking wrote:Phew. I'm sorry, you'Re right. It is a custom Serendipity rewrite rule, that matches 'admin' too broadly:
Ah ha, good to know that I'm not crazy.

A better fix is to correct pattern. I've a had a look in the code I can't find where it is defined PAT_ADMIN. If you can point in the right direction I'll see if I can fix it up.

Cheers!

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Wed Jul 25, 2007 11:17 pm
by garvinhicking
Hi!
A better fix is to correct pattern. I've a had a look in the code I can't find where it is defined PAT_ADMIN. If you can point in the right direction I'll see if I can fix it up.
It's a bit hidden in the file include/functions_permalinks.inc.php, function serendipity_permalinkPatterns(), $PAT['ADMIN'].

However after you changed that you still need to regenerate/alter your .htaccess file.

HTH,
Garvin

Re: If you have a tag "admin" s9y goes to admin pa

Posted: Thu Jul 26, 2007 6:48 am
by puck
Hi Garvin,
garvinhicking wrote:It's a bit hidden in the file include/functions_permalinks.inc.php, function serendipity_permalinkPatterns(), $PAT['ADMIN'].
Awesome. Here is a patch that won't match a tag called admin:

Code: Select all

diff --git a/include/functions_permalinks.inc.php b/include/functions_permalinks.inc.php
index 85680a0..004c4fa 100755
--- a/include/functions_permalinks.inc.php
+++ b/include/functions_permalinks.inc.php
@@ -277,7 +277,7 @@ function &serendipity_permalinkPatterns($return = false) {
     $PAT['DELETE']                   = '@/'  . $serendipity['permalinkDeletePath'].'/(.*)/(.*)/([0-9]+)@';
     $PAT['ARCHIVES']                 = '@/'  . $serendipity['permalinkArchivesPath'].'([/A-Za-z0-9]+)\.html@';
     $PAT['FEEDS']                    = '@/'  . $serendipity['permalinkFeedsPath'].'/@';
-    $PAT['ADMIN']                    = '@/(' . $serendipity['permalinkAdminPath'] . '|entries)(/.+)?@';
+    $PAT['ADMIN']                    = '@/(?<!tag\/)(' . $serendipity['permalinkAdminPath'] . '|entries)(/.+)?@';
     $PAT['ARCHIVE']                  = '@/'  . $serendipity['permalinkArchivePath'] . '/?@';
     $PAT['CATEGORIES']               = '@/'  . $serendipity['permalinkCategoriesPath'].'/([0-9;]+)@';
     $PAT['PLUGIN']                   = '@/('  . $serendipity['permalinkPluginPath'] . '|plugin)/(.*)@';
However after you changed that you still need to regenerate/alter your .htaccess file.
For whatever reason it isn't in my .htaccess, restarting Apache2 picked up the change.

Looking at some of the other patterns I suspect there is a good chance there are other tags which will cause issues as well.

/me shrugs

Cheers!