URL rewriting problem

Having trouble installing serendipity?
Post Reply
KodrutZ
Regular
Posts: 17
Joined: Sun Dec 07, 2008 11:05 am
Location: Romania
Contact:

URL rewriting problem

Post by KodrutZ »

Hello everyone, this is my first post here, but it won't be the last, for sure. Here's my problem...

I have a Serendipity blog hosted in a subfolder of my hosting account, called - how else - "Serendipity." I didn't install in the root folder because I am hosting multiple sites there, and I wouldn't like to see more folders than I should in the root, and the .htaccess in the root looks like this:

Code: Select all

RewriteEngine On
RewriteOptions MaxRedirects=1
RewriteCond %{HTTP_HOST} ^nistorcodrut\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.nistorcodrut\.com$
RewriteCond %{REQUEST_URI} !^/Serendipity/(.*)
RewriteRule (.*) /Serendipity/$1
So far, so good - once you go to www.nistorcodrut.com or nistorcodrut.com, you get the home page of the Serendipity blog. The problems is that, once you click to read some article, you get a link like www.nistorcodrut.com/Serendipity/title, and what I would like is to get www.nistorcodrut.com/title. Below, you have the .htaccess generated by Serendipity, after messing a little with the URL rewrite rules:

Code: Select all

# BEGIN s9y
ErrorDocument 404 /Serendipity/index.php
DirectoryIndex /Serendipity/index.php

RewriteEngine On
RewriteRule ^(([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-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 
Bonus question: as things are looking now, if you click to see the next page of entries on the main page of the blog, you get an error, but if you browse the archive, you can go back and forth through the pages. What's wrong with that one?

Roundup - what I would like is to have all the www.nistorcodrut.com/Serendipity/some-title links turn into www.nistorcodrut.com/some-title, and if that can be done without messing too much with what Google sees, that would be great. After all, there are only a few indexed pages, and this is not a commercial blog, so it's no tragedy not to have it indexed right, at least for now.

Thanks in advance!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: URL rewriting problem

Post by garvinhicking »

Hi!

Running with permalinks outside of the s9y structure has not been tested by our developers; it is not supported.

I think you might need to change your s9y configuration to get rid of "/Serendipty/" in every URL and permalink, but I'm not sure if it will work like this. Usually if I need permalinks like those, I simply install s9y in the root.

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/
KodrutZ
Regular
Posts: 17
Joined: Sun Dec 07, 2008 11:05 am
Location: Romania
Contact:

Indeed...

Post by KodrutZ »

...I was afraid of this answer, so here's my new question - if I change the path to installation in config from /Serendipity/ to /, and then I move the entire folder structure from /Serendipity/ to my hosting root folder, should I run into any special problems?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Indeed...

Post by garvinhicking »

Hi!

This depends on how many blog entries you already have; any links you might have set to /Serendipity/ before you will need to correct. Often this is easily done by exporitng a SQL dump and using Search+üReplace for the old and new path.

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/
KodrutZ
Regular
Posts: 17
Joined: Sun Dec 07, 2008 11:05 am
Location: Romania
Contact:

Moving on...

Post by KodrutZ »

...after I moved my Serendipity install to my root folder, everything is almost fine, but...

1. If I try to change the settings so I can have entries displayed as "www.ssss.com/title/," it works, but I can't access the admin section any longer(page doesn't exist error). I restore my backed up .htacess and everything works well again, except that....

2. When I click to see all entries in a certain category, I get an error saying that category is empty.

Where should I look to fix these?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Moving on...

Post by garvinhicking »

Hi!

You should always be able to access your admin backend through http://yourblog/serendipity_admin.php.

Actually, the permalink scheme of s9y is not meant to work without a subdirectory like /archives or /entries or something like that. Those only work with the "custom permalinks plugin", so that you need to specify such a permalink in addition to the usual internal ones, where you can also use patters in the root directory.

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/
Post Reply