Permalink "bug" workaround
Permalink "bug" workaround
Hi Folks,
when setting up my new blog, I experienced a strange behaviour of s9y when I changed the permalink structure for the articles from ..."%id%-%title%.html" to ..."%title%.html" (just removing the "%id%-" tag for seo reasons).
When I entered a new article with a title containing only one word (e.g. "spaceship") the entry could not be displayed. It only appeared the message "Keine Einträge vorhanden". Therefore I gave a closer look to the .htaccess file and examined some kind of confusion of the rules. It seemed to me that the first rewrite rule didn't fit to permalinks with only one word in the title and no id. Therefore I changed the permalink rule to ..."%title%.htm" (just ".htm" not ".html") and guess what. It worked!
Maybe someone who is more experienced in mod rewriting has a solution for a modification of the first rewrite rule starting with "^((" so that it will fit for ".html" endings as well.
Best regards
Greg
when setting up my new blog, I experienced a strange behaviour of s9y when I changed the permalink structure for the articles from ..."%id%-%title%.html" to ..."%title%.html" (just removing the "%id%-" tag for seo reasons).
When I entered a new article with a title containing only one word (e.g. "spaceship") the entry could not be displayed. It only appeared the message "Keine Einträge vorhanden". Therefore I gave a closer look to the .htaccess file and examined some kind of confusion of the rules. It seemed to me that the first rewrite rule didn't fit to permalinks with only one word in the title and no id. Therefore I changed the permalink rule to ..."%title%.htm" (just ".htm" not ".html") and guess what. It worked!
Maybe someone who is more experienced in mod rewriting has a solution for a modification of the first rewrite rule starting with "^((" so that it will fit for ".html" endings as well.
Best regards
Greg
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Permalink "bug" workaround
Hi!
Could you maybe post your full .htaccess, then I could easier try to see what's happening?
Regards,
Garvin
Could you maybe post your full .htaccess, then I could easier try to see what's happening?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi Garvin,
of course. The blog I'm working on, is not ready to be published, but I found out that the same "bug" appeared on another blog of mine. Here's the code:
Greetings
Greg
of course. The blog I'm working on, is not ready to be published, but I found out that the same "bug" appeared on another blog of mine. Here's the code:
Code: Select all
# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php
php_value session.use_trans_sid 0
php_value register_globals off
RewriteEngine On
RewriteBase /
RewriteRule ^(archives/[0-9a-z\.\_!;,\+\-\%]+\.html) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/[0-9a-z\.\_!;,\+\-\%]+-([0-9]+)\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
<Files *.tpl.php>
deny from all
</Files>
<Files *.tpl>
deny from all
</Files>
<Files *.sql>
deny from all
</Files>
<Files *.inc.php>
deny from all
</Files>
<Files *.db>
deny from all
</Files>
# END s9y
Greg
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
if you reomve the first rewrite rule, everything works as expected, right?
I'll try to see, I think the matter is because the one pattern redirects to index.php?/blabla and the other to index.php?url=/blabla...
regard,s
garvin
if you reomve the first rewrite rule, everything works as expected, right?
I'll try to see, I think the matter is because the one pattern redirects to index.php?/blabla and the other to index.php?url=/blabla...
regard,s
garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi,
no, removing the first rewrite rule doesn't change anything. Neither does removing all of them. Pretty confusing for me, because I dont really understand why they are needed. As far as I can see I would expect the line
to be the reason for the missbehaviour. Something like "If the url is not found load index.php" and "index.php" may examine the url and tries to get the entry?
Greg
no, removing the first rewrite rule doesn't change anything. Neither does removing all of them. Pretty confusing for me, because I dont really understand why they are needed. As far as I can see I would expect the line
Code: Select all
ErrorDocument 404 /index.php
Greg
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Which s9y version do you use? Can you try s9y 1.3? I just saw that we changed the format of the .htaccess there. By upgrading, you can change the permalinks, save the configuration (.htaccess will be updated then to the new format), that should hopefully work.
It changes "index.php?url=..." to "index.php?/...".
Regards,
Garvin
Which s9y version do you use? Can you try s9y 1.3? I just saw that we changed the format of the .htaccess there. By upgrading, you can change the permalinks, save the configuration (.htaccess will be updated then to the new format), that should hopefully work.
It changes "index.php?url=..." to "index.php?/...".
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi,
so I updated the blog to the 1.3 alpha1 version, but it didn't change a lot. Now, after removing the %id%- from the permalinks configuration option, titles which contain only one word are still not clickable. A page appears, that shows any entry starting with the second last. Renaming the ".html" to ".htm" in the permalinks configuration option does still solve the problem.
Greg
so I updated the blog to the 1.3 alpha1 version, but it didn't change a lot. Now, after removing the %id%- from the permalinks configuration option, titles which contain only one word are still not clickable. A page appears, that shows any entry starting with the second last. Renaming the ".html" to ".htm" in the permalinks configuration option does still solve the problem.
Greg
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Did s9y update the .htaccess for you (have a look at the modification date). Only some changes trigger s9y to update that file...
Regards
,Garvin
Did s9y update the .htaccess for you (have a look at the modification date). Only some changes trigger s9y to update that file...
Regards
,Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Yes, sure: the modification date is 2008-01-20. When I ment, I updated the software, I made myself not clear enough. Actually, I did a complete and whole new installation. I can't imagine that I'm the only one with this problem. But it seems to be so, as no other follows this discussion...garvinhicking wrote: Did s9y update the .htaccess for you (have a look at the modification date).
here again the code of my .htaccess file:
Code: Select all
# BEGIN s9y
ErrorDocument 404 /blog/index.php
DirectoryIndex /blog/index.php
php_value session.use_trans_sid 0
php_value register_globals off
RewriteEngine On
RewriteBase /blog/
RewriteRule ^((archives/[0-9a-z\.\_!;,\+\-\%]+\.htm)/?) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/name%\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^comments/(.*) index.php?url=/comments/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
<Files *.tpl.php>
deny from all
</Files>
<Files *.tpl>
deny from all
</Files>
<Files *.sql>
deny from all
</Files>
<Files *.inc.php>
deny from all
</Files>
<Files *.db>
deny from all
</Files>
# END s9y
EDIT: And again, I think it must be a problem within the index.php, because also switching off the whole Rewrite Engine doesn't have any effect.
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Could you show us the URL to the mentioned blog?
Does it work if you change:
to
Regards,
Garvin
Could you show us the URL to the mentioned blog?
Does it work if you change:
Code: Select all
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
Code: Select all
RewriteRule (.*\.html?) index.php?/$1 [L,QSA]
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Core Developer
- Posts: 30020
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Hm, I'm afraid I can only try to check some things when I can get to the URL of the blog...maybe once you put it temporarily online?
Regards,
Garvin
Hm, I'm afraid I can only try to check some things when I can get to the URL of the blog...maybe once you put it temporarily online?
Ah, for that you'd have to patch core s9y code - the feature does not exist to put a "nested" Category-permalink URL... (if you want to have proper automatic category url creation, of course - manually it will be sufficient to patch .htaccess)no the suggested code doesn't change anything. I'm still designing the blog local, so it isn't online yet. Besides: I also want/have to change the permalinks to parentcategory/category/title.html, so I have to rewrite the .htaccess completely and may get rid of the "bug" then.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Hi Garvin,
I'm stuck with my attempts to change the category permalink structure and hope you can give me a hint.
At first I wanted to get each parent category automatically by a new function. Because of a heavy performance loss I dumped this solution and decided to "fake" the link structure by renaming each category to "parencategory/category" (e.g. formerly category name "augsburg" in parent category "bayern" changed to "bayern/augsburg"). Therefore I changed the PAT_FILENAME definition in the functions_permalinks.inc.php to keep the slash, but for some reason the permalink ...categories/bayern/augsburg doesn't work. It displays all entries, not only the one from the specific category "bayern/augsburg".
Any suggestions?
Thx, Greg
EDIT: Got it! I missed to alter the permalink configuration as well. Now it works.
I'm stuck with my attempts to change the category permalink structure and hope you can give me a hint.
At first I wanted to get each parent category automatically by a new function. Because of a heavy performance loss I dumped this solution and decided to "fake" the link structure by renaming each category to "parencategory/category" (e.g. formerly category name "augsburg" in parent category "bayern" changed to "bayern/augsburg"). Therefore I changed the PAT_FILENAME definition in the functions_permalinks.inc.php to keep the slash, but for some reason the permalink ...categories/bayern/augsburg doesn't work. It displays all entries, not only the one from the specific category "bayern/augsburg".
Any suggestions?
Thx, Greg
EDIT: Got it! I missed to alter the permalink configuration as well. Now it works.
OK,
besides my research with the parent categories / categories structure I found the cause, why entries with a "one word only html-title" (e.g. spaceship.html) won't be displayed, when no %id% is given to s9y. The URI then matches the PAT_ARCHIVES pattern in index.php (the "more than one word titles" don't match this pattern because of the "-" in the uri).
Greg
EDIT: I just had a look at the PAT_ARCHIVES pattern. Is there any possibility to get the arives pattern different from one word entry titles? Does every archives url end on a number?
besides my research with the parent categories / categories structure I found the cause, why entries with a "one word only html-title" (e.g. spaceship.html) won't be displayed, when no %id% is given to s9y. The URI then matches the PAT_ARCHIVES pattern in index.php (the "more than one word titles" don't match this pattern because of the "-" in the uri).
Greg
EDIT: I just had a look at the PAT_ARCHIVES pattern. Is there any possibility to get the arives pattern different from one word entry titles? Does every archives url end on a number?
Hi,
would
be an adequate replacement for the ARCHIVES PATTERN in functions_permalinks.inc.php? I searched a bit within my blog and it seems to me that archive urls either consit of numerical chars and a slash or numerical chars, a slash and a "C" when displaying a category archive.
Regards
Greg
would
Code: Select all
$PAT['ARCHIVES'] = '@/' . $serendipity['permalinkArchivesPath'].'([/0-9C]+)\.html@';
Regards
Greg