"RewriteEngine On" and static pages

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

"RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 8:02 am

Hi,

I seem to miss something.

Due to a hint, I set "RewriteEngine On" in my Apache config and changed the blog configuration about URL forming rewriting to "Use Apache mod_rewrite".

Now static pages are not working anymore: http://www.deimeke.net/dirk/blog/index. ... print.html

Serendipity Version is 1.7.2

Any ideas?

Cheers

Dirk

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "RewriteEngine On" and static pages

Post by Timbalu » Wed Jul 31, 2013 9:24 am

That seems vaguely familiar .... :wink:

Administration / Configuration → Paths → which settings do you have there?

If, for example, you access (staticpage) contacts, you will indeed be returned, but in the address url with a wrong path, which - in pagination - leads to something like this
http://www.deimeke.net/dirk/blog/pages/ ... /P216.html
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 10:08 am

:-)

Good to know that I am not allone.

Path for contact form: /dirk/blog/index.php?/pages/contactform.html

Configuration paths (I can not remember that I ever touched them):

Code: Select all

Voller Pfad - /srv/www/deimeke.net/dirk/blog/
Upload-Pfad - uploads/
Relativer HTTP-Pfad - /dirk/blog/
Relativer Template-Pfad - templates/
Relativer Upload-Pfad - uploads/
URL zum Blog - http://www.deimeke.net/dirk/blog/
Cheers

Dirk

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "RewriteEngine On" and static pages

Post by Timbalu » Wed Jul 31, 2013 10:22 am

Not happend to me, but it sounded familiar to the blogUrl issue and some other thread I remembered...

But this looks good! Does not need to change, IMO.

Was you htaccess file changed, after switching to mod_rewrite in Serendipity?

Since http://www.deimeke.net/dirk/blog/pages/about_me.html (already as nice url) does not do also...

You might also need to test, if your apache config setting regarding mod_rewrite really happens... is the extension modul available and did your reload your webserver? (Test with some small script...)

I assume this issue (and sql error) also happens while in combination with that reverse ORDER BY thing in the config...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2239
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: "RewriteEngine On" and static pages

Post by onli » Wed Jul 31, 2013 10:59 am

In the static pages settings, change the path of the page from /index.php?/page/... to /page; remove the index.php-part.
Regards

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 2:50 pm

Timbalu wrote:Was you htaccess file changed, after switching to mod_rewrite in Serendipity?

Since http://www.deimeke.net/dirk/blog/pages/about_me.html (already as nice url) does not do also...
Yes, it was changed.

[/quote]You might also need to test, if your apache config setting regarding mod_rewrite really happens... is the extension modul available and did your reload your webserver? (Test with some small script...)

I assume this issue (and sql error) also happens while in combination with that reverse ORDER BY thing in the config...[/quote]

mod_rewrite works so far and it is loaded by the webserver.
onli wrote:In the static pages settings, change the path of the page from /index.php?/page/... to /page; remove the index.php-part.
Hmpf, that means I have to find all blog articles that link to static pages?

That's bad.

Cheers

Dirk

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "RewriteEngine On" and static pages

Post by Timbalu » Wed Jul 31, 2013 3:25 pm

You must have changed something essential, since staticpage nav link http://www.deimeke.net/dirk/blog/index. ... print.html etc do work now as expected... without the need to change to a nice url in that staticpage config.

...and still nice Urls do not work http://www.deimeke.net/dirk/blog/pages/imprint.html ending with an error
Not Found

The requested URL /index.php was not found on this server.
But your index.php is at /dirk/blog/

Having this, I would request to have a look into your htaccess file, to see what these rules

Code: Select all

ErrorDocument 404 /dirk/blog/index.php
DirectoryIndex /dirk/blog/index.php
look like...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2239
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: "RewriteEngine On" and static pages

Post by onli » Wed Jul 31, 2013 3:47 pm

Lux wrote: Hmpf, that means I have to find all blog articles that link to static pages?
No, the old links seem to remain working. I had the same situation in my own blog. Just try it out with one of the pages.

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 3:48 pm

Timbalu wrote:You must have changed something essential, since staticpage nav link http://www.deimeke.net/dirk/blog/index. ... print.html etc do work now as expected... without the need to change to a nice url in that staticpage config.
Yes, I removed the "Use Apache mod_rewrite" option without disabling mod_rewrite.
Timbalu wrote:...and still nice Urls do not work http://www.deimeke.net/dirk/blog/pages/imprint.html with an error
Not Found

The requested URL /index.php was not found on this server.
but your index.php is at /dirk/blog/
Where did you get the URL from?

http://www.deimeke.net/dirk/blog/index. ... print.html is working.
Timbalu wrote:Having this, I would request to have a look into your htaccess file, to see what your

Code: Select all

ErrorDocument 404 /dirk/blog/index.php
DirectoryIndex /dirk/blog/index.php
look like...
This is the complete file /srv/www/deimeke.net/.htaccess

Code: Select all

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?qs=$1 [L]
Cheers

Dirk

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 3:50 pm

onli wrote:
Lux wrote: Hmpf, that means I have to find all blog articles that link to static pages?
No, the old links seem to remain working. I had the same situation in my own blog. Just try it out with one of the pages.
I tried and it did not work.

With the option "Use Apache mod_rewrite" static pages do not work anymore. With the option turned off they are working.

Cheers

Dirk

User avatar
onli
Regular
Posts: 2239
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: "RewriteEngine On" and static pages

Post by onli » Wed Jul 31, 2013 3:54 pm

Mod_rewrite was on and working and you changed the link in the staticpage-configuration itself?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "RewriteEngine On" and static pages

Post by Timbalu » Wed Jul 31, 2013 4:02 pm

Lux wrote:Yes, I removed the "Use Apache mod_rewrite" option without disabling mod_rewrite
ok thats why... :wink:
Lux wrote:Where did you get the URL from?
Nowhere. I created it manually to test.... since this is the nice url way which will happen with mod_rewrite ON.
Lux wrote:
Timbalu wrote:Having this, I would request to have a look into your htaccess file, to see what your

Code: Select all

ErrorDocument 404 /dirk/blog/index.php
DirectoryIndex /dirk/blog/index.php
look like...
This is the complete file /srv/www/deimeke.net/.htaccess

Code: Select all

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?qs=$1 [L]
Yeah, and that is the fault, since this root .htaccess overwrites or overrules your /dirk/blog/.htaccess file, which is the Serendipity blog .htaccess file. Have a look into this.

This will certainly be the main issue... and might be as well this, from your front-root-index page: http://dirk.deimeke.net/ linking internally to http://www.deimeke.net/dirk/blog/
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 4:20 pm

onli wrote:Mod_rewrite was on and working and you changed the link in the staticpage-configuration itself?
Yes, exactly. This option does not seem to affect existing pages.

Correction: There is no global setting for static pages. In all blogs I have around 60 (or 80) static pages, I don't have the energy to correct each and every one and all pages and articles that refer to those.

Dirk
Last edited by Lux on Wed Jul 31, 2013 4:29 pm, edited 1 time in total.

User avatar
Lux
Regular
Posts: 761
Joined: Fri Aug 12, 2005 4:36 pm
Location: Grüt, Zürich, Switzerland
Contact:

Re: "RewriteEngine On" and static pages

Post by Lux » Wed Jul 31, 2013 4:26 pm

Timbalu wrote:This is the complete file /srv/www/deimeke.net/.htaccess

Code: Select all

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?qs=$1 [L]
Yeah, and that is the fault, since this root .htaccess overwrites or overrules your /dirk/blog/.htaccess file, which is the Serendipity blog .htaccess file. Have a look into this.[/quote]

Hm. Don't like ...
Timbalu wrote:This will certainly be the main issue... and might be as well this, from your front-root-index page: http://dirk.deimeke.net/ linking internally to http://www.deimeke.net/dirk/blog/
dirk.deimeke.net is a separate subdomain, which is redirected via apache config to the blog. This is out-of-scope, since this generates a new http-request on the client side with the correct domain.

But, if the root .htaccess overwrites the local config in the directory this is senseless, isn't it?

This is from the blog.

Code: Select all

# BEGIN s9y
DirectoryIndex /dirk/blog/index.php
php_value session.use_trans_sid 0
php_value register_globals off

<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
Cheers

Dirk

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "RewriteEngine On" and static pages

Post by Timbalu » Wed Jul 31, 2013 4:35 pm

What do you mean by "Hm. Don't like ..." ??

Your blogs htaccess will need this too. I presume.

Code: Select all

 ErrorDocument 404 /dirk/blog/index.php
and

Code: Select all

RewriteEngine On
RewriteBase /dirk/blog/
RewriteRule ^serendipity_admin.php serendipity_admin.php [NC,L,QSA]
RewriteRule ^((archives/([0-9]+)\-[0-9a-z\.\_!;,\+\-\%]+\.html)/?) index.php?/$1 [NC,L,QSA]
RewriteRule ^(authors/([0-9]+)\-[0-9a-z\.\_!;,\+\-\%]+) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)\-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(feeds/authors/([0-9]+)\-[0-9a-z\.\_!;,\+\-\%]+\.rss) index.php?/$1 [NC,L,QSA]
RewriteRule ^(categories/([0-9;]+)\-[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]
#RewriteCond %{REQUEST_URI} !-U
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

This all is missing. This is the reason why you never have a successfull rewrite.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply