Page 1 of 1

Possible HTACCESS problems

Posted: Tue Dec 04, 2007 1:01 pm
by GoneShootin2
Hi

This link works:
http://localhost:8081/blackwater/index. ... -Club.html

This link doesn't:
http://localhost:8081/blackwater/archiv ... -Club.html

My HTACCESS:

Code: Select all

RewriteEngine On
RewriteBase /blackwater/
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]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
HELP! :)

Re: Possible HTACCESS problems

Posted: Tue Dec 04, 2007 1:31 pm
by garvinhicking
Hi!

What doesn't work? You did install mod_rewrite for Apache?

Regards,
Garvin

Posted: Tue Dec 04, 2007 3:42 pm
by GoneShootin2
Hmmm, now that you mention it, it would seem that I don't. Its not appearing on my phpinfo file, yet I have it enabled in httpconf:

LoadModule rewrite_module modules/mod_rewrite.so

How do I install the mod?

Posted: Tue Dec 04, 2007 4:04 pm
by garvinhicking
Hi!

You might need to compile it for apache by using configure with the appropriate module string (--enable=rewrite or sth like it).

You might want to search an apache forum for more help on this issue, as it's unrelated to serendipity...

Good luck,
Garvin

Posted: Tue Dec 04, 2007 4:16 pm
by GoneShootin2
Twas my httpconf was causing me my grief

Code: Select all

<Directory "C:/Server/Apache2/htdocs">
    Order allow,deny
    Allow from all
    Options All
    AllowOverride All
</Directory>
Works now with above.

Posted: Wed Dec 19, 2007 12:05 am
by GoneShootin2
I'm back again.

I've embedded my serendipity installation into an exsting html page. Works fine, until I try to click on the extended body, and it heads off to /archives.

This wraps perfectly:

Code: Select all

http://localhost:8081/blackwater/index.php?/cms/archives/1-About-Blackwater-Triathlon-Club.html
This doesn't:

Code: Select all

http://localhost:8081/blackwater/cms/archives/1-About-Blackwater-Triathlon-Club.html
So it's probably my conf file again, or the wrapper, which is:

Code: Select all

  $_SERVER['REQUEST_URI'] = '/cms' . $_SERVER['REQUEST_URI'];
   ob_start(); 
   chdir("C:\Server\Apache2\htdocs\blackwater\cms"); 
   require("index.php"); 
   chdir("../"); 
   $serendipity_content = ob_get_contents(); 
   ob_end_clean(); 
   echo $serendipity_content 
Any ideas?

Posted: Wed Dec 19, 2007 12:49 pm
by garvinhicking
Hi!

If the "cms" path is executed, I suppose the wrapper gets executed again,and thus appends "cms/" to the request-uri again. So you'll need to first check whether "cms/" is already contained in that file, and only append it, if it isn't...

Regards,
Garvin

Posted: Thu Dec 20, 2007 12:02 am
by GoneShootin2
The problem though is that the wrapper will never get called if I follow the natural /cms/archives link from my embedded page, as the wrapper is only called in my index page, not subsequent pages.

So how am I going to fool serendipity into calling my ../index.php to load each link cleanly I wonder, and not /cms/archives......


---- EDIT -----

I got it working by using "/blackwater/index.php?cms/" as my Relative Path. Works just fine now.


BUT

I suddenly realise that I'm not comfortable with someone browsing to say cms/index.php and running the content from there. I need to force the user to jump back to ../index.php.

So my option at this stage might be to move serendipity back into the root, and attempt the wrapping logic within the same folder perhaps? I know if I cracked this it would be plain sailing from here on out...

---- EDIT -----

And thats what I did. I had to add index.php? to the start of all my perma links, but it seems to work. I called my serendipity index file "contents.php". If anyone has a more graceful approach then let me know, for example how to prevent contents.php from being directly access in future, and ensuring that my index.php [which contains my templating] is actually called.