Page 1 of 1
changing templates and htaccess behavior
Posted: Sat Aug 19, 2006 12:20 pm
by Timbalu
Hi
I get my pages like
which works perfectly. [1.0.1]
I activated the template chooser plugin. After changing the templates the url looks like,
Code: Select all
serendipity/index.php?pages/myplugin.html
but does not link to the plugin. Its not a matter of my plugin I think, it must have to do with the .htaccess file, which includes all normal rewrite engine ON inputs.
Is there a way to change the behavior with htaccess? I just need to get rid of the 'index.php?'.
Regards, Ian
Posted: Mon Aug 21, 2006 10:45 am
by Timbalu
someone any ideas?
Posted: Mon Aug 21, 2006 10:57 am
by garvinhicking
Hi!
Did you change your "URL Rewriting" option in the s9y configuration? This change cannot be related to the template chooser plugin.
What's your URL?
Regards,
Garvin
Posted: Mon Aug 21, 2006 11:38 am
by Timbalu
Hi Garvin
Yes thats what I said... it seems like a matter of .htaccess
I did not change my "URL Rewriting" option in the s9y configuration,
see examples:
Regards, Ian
Code: Select all
/s9y/pages/imprint.html [Template 1]
/s9y/index.php?pages/imprint.html [url look in Template 2]
changing template this will
not get redirected and shows just the start page
Code: Select all
/s9y/pages/contact.html [Template 1]
/s9y/index.php?pages/contact.html [url look in Template 2]
changing template this will
not get redirected and shows just the start page
Code: Select all
/s9y/archives/269-Die-letzte-Fahrt.html [Template 1]
/s9y/index.php?archives/269-Die-letzte-Fahrt.html [url look in Template 2]
changing template this
will get redirected and shows the correct page!!
Code: Select all
/s9y/plugin/bookmarks [Template 1]
/s9y/index.php?plugin/bookmarks [url look in Template 2]
changing template this will
not get redirected and shows just the start page
Code: Select all
/s9y/archive [Template 1]
/s9y/index.php?archive [url look in Template 2]
changing template this will
not get redirected and shows just the start page
.htaccess
Code: Select all
# BEGIN s9y
ErrorDocument 404 /s9y/index.php
DirectoryIndex /s9y/index.php
RewriteEngine On
RewriteBase /s9y/
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [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 ^categories/([0-9]+) index.php?url=/categories/$1 [L,QSA]
RewriteRule ^(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$ rss.php?file=$1&ext=$2
RewriteRule ^plugin/(.*) index.php?url=plugin/$1 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^authors/([0-9]+) index.php?url=/authors/$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>
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
Posted: Mon Aug 21, 2006 11:40 am
by garvinhicking
Hi!
What is Template 1 and Template?
URLs like "index.php?archives/..." will ONLY be created if "URL Rewriting" in your s9y configuration is set to "NONE". Or if any of your plugins or code sets
Check your serendipity_config database, see what "rewrite" is set to there.
Best regards,
Garvin
Posted: Mon Aug 21, 2006 11:50 am
by Timbalu
checked!
name value authorid
rewrite rewrite 0
Template 1 and 2 mean just examples for real templates, which can be choosen in the template dropdown sidebar plugin.
The failure just appears when I change between the templates.
Posted: Mon Aug 21, 2006 11:59 am
by garvinhicking
Hi!
Are you speaking only of the URL that you get, when you are viewing an entry and then changing the template? If so: The URL needs to use index.php?XXX for the target of the form that the templatedropdown uses. It is not allowed to send POST variables to URLs that are modified via Apache Errorhandling. Thus, we POST the values to the globally recognized URL.
In that case, it's not a bug - technically it only really works well that way.
Regards,
Garvin
Posted: Mon Aug 21, 2006 12:07 pm
by Timbalu
Ok, but if I am in template 1 inside /pages/imprint.html and I change the template the new template opens the startpage and not /pages/imprint.html.
As described it works with normal article entries.
So we just need to get rid of the 'index.php?' in the url and the behavior will be ok.
Ian
Posted: Mon Aug 21, 2006 12:08 pm
by garvinhicking
What's your URL?
We cannot get rid of index.php. I explained why.
Regards,
Garvin
Posted: Mon Aug 21, 2006 12:50 pm
by Timbalu
Hi Garvin
did you see what I meant ??
Posted: Tue Aug 22, 2006 9:04 pm
by judebert
I didn't see any URL for your page, so I tried it on my own. For instance:
http://judebert.com/wasted_youth/archiv ... c-Car.html works fine with my default template. Then I used the template dropdown to change to Blue Haze; that worked fine, too, even though it uses the index.php?XXX method (because the template changer needs to send a POST variable, just like Garvin mentioned).
No problem with more complex themes, such as Ladybug, either.
Figuring it might be something with permalinks (as opposed to the archive link I used before), I tried the same thing on
http://judebert.com/wasted_youth/EV/Aftermath.html.
That demonstrates the same error I think you're describing: the index.php?XXX version tries to use my permalink for the XXX, and Serendipity gets confused. Maybe because there's no article ID. And when Serendipity gets confused, it sends you to the front page.
So, if you're using permalinks, my first suggestion at a workaround would be to change the permalink to include an article number, right up front.
Perhaps if we can see the problem on your site we'll be better able to understand it and produce a solution?
Posted: Tue Aug 22, 2006 9:12 pm
by Timbalu
Oh sorry!
Garvin and I allready worked out a solution, changing functions_permalinks.inc.php and serendipity_plugin_templatedropdown.php. I think Garvin made a change for the public.
Regards, Ian