Template lost when changing path or permalink: workaround
Posted: Wed Jul 31, 2013 10:55 pm
Serendipity 1.7, Apache 2 and PHP 5.3.2-1
I first made a test install with the default settings, in directory "serendipity/". When I decided to keep the software I played around with the permalink structure per URL-rewriter (settled on %id%/%title%) and set up a virtual host on the server. Configured the relative path in s9y to "/" but kept it in the serendipity/ directory on disk. All worked except that at some point in the process (changing forth and back), the image files went missing. So basically it showed text only, with styles applied but without any graphics. With the admin panel, all style was gone. Sorry I can't repeat the process as I can't tell for sure what exactly I did when it happened.
Took me a while inspecting what was going wrong. I found that it served the index.html content for every file! The logical conclusion: there's something wrong with the rewriting that s9y does, not with my own. There's this line in .htaccess: which will redirect any request to "index.php?/path/to.file" but s9y seems to have a problem finding the right file, thus falling back to index.php. In my case, it is safe to remove that line, as it is bogus, and this made it work.
For the same reason, I guess, the admin stylesheet stopped working: I changed this to
which is a crude hack (hard-coded path) but now at least the admin panel has style again.
Stylesheet URL in the HTML that is served is on the main page and with the admin panel, respectively.
Because most of the rewrite lines do a rewrite to "index.php?url=*", I guess that there are other similar errors waiting but I didn't test all the features yet.
hth,
Mintaka
I first made a test install with the default settings, in directory "serendipity/". When I decided to keep the software I played around with the permalink structure per URL-rewriter (settled on %id%/%title%) and set up a virtual host on the server. Configured the relative path in s9y to "/" but kept it in the serendipity/ directory on disk. All worked except that at some point in the process (changing forth and back), the image files went missing. So basically it showed text only, with styles applied but without any graphics. With the admin panel, all style was gone. Sorry I can't repeat the process as I can't tell for sure what exactly I did when it happened.
Took me a while inspecting what was going wrong. I found that it served the index.html content for every file! The logical conclusion: there's something wrong with the rewriting that s9y does, not with my own. There's this line in .htaccess:
Code: Select all
RewriteRule ^([0-9a-z\.\_!;,\+\-\%/]*/[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
For the same reason, I guess, the admin stylesheet stopped working:
Code: Select all
RewriteRule ^(serendipity\.css|serendipity_admin\.css)$ index.php?url=/$1 [L,QSA]
Code: Select all
RewriteRule ^(serendipity\.css|serendipity_admin\.css)$ templates/default/admin/style.css [L,QSA]
Stylesheet URL in the HTML that is served is
Code: Select all
http://blog.[domain].net/index.php?/plugin/categorytemplate_default
and
http://blog.[domain].net/serendipity_admin.css
/templates/default/admin/pluginmanager.css
Because most of the rewrite lines do a rewrite to "index.php?url=*", I guess that there are other similar errors waiting but I didn't test all the features yet.
hth,
Mintaka