Page 1 of 1

sub-folders (seperate domains) inherit .htaccess behavior

Posted: Wed Jan 12, 2005 4:48 am
by cptnwinky
I want to know how to stop this from happening.

I currently have several domains hosted on one server and the latest beta of serendipity installed in the root folder. All the domains are inside folders as I'm sure you have all encountered before. The problem is when viewing one of these other domains, for instance if I go to...

sub-folder-domain.com/myfolder/

instead of...

sub-folder-domain.com/myfolder/index.php

the first one inherits all the behavior of sub-folder-domain.com/ without images and all that.

This is particularly annoying as now when I access these pages (luckily none of them are live) I have to always specify the page I want to visit rather than just specifying the folder and having the index take it's place.

how can I fix this?

Re: sub-folders (seperate domains) inherit .htaccess behavio

Posted: Wed Jan 12, 2005 10:31 am
by garvinhicking
Have you looked into the .htaccess file of "myfolder"? Maybe it has some directions in it that cause the behavior...

Regards,
Garvin

Posted: Wed Jan 12, 2005 4:43 pm
by cptnwinky
Yeah, I tried commenting out the 404 error handler part but that did not work. Other than that I am not familiar with mod_rewrite.

Posted: Wed Jan 12, 2005 5:48 pm
by garvinhicking
Did you try temporarily removing your .htaccess file? Do you have an actual URL to look at the problem, please?

Regards,
Garvin

Posted: Wed Jan 12, 2005 5:57 pm
by cptnwinky
Ok, removing it did help.

The root folder is the folder for http://www.civilissues.com/

A sub-folder that contains another domain is http://www.main-dish.com/ the sub-folder for this would be civilissues.com/maindish/

Now if you view main-dish.com and look at the sample layout (it's a work in progress) and then view this link...

http://www.main-dish.com/v2/admin/

compared to what it's supposed to look like at...

http://www.main-dish.com/v2/admin/index.php

I think you will get the idea of what is going on.

Posted: Thu Jan 13, 2005 7:14 pm
by garvinhicking
If removing it helps, it seems to me the ErrorDocument or DirectoryIndex directives in there seem to be wrong. I get completely different HTML output for the two paths you mentioned, which means that calling the URL without a path names includes a files specified in the directive, which isn't what you want. So either patch up the .htaccess or configure your Apache VirtualHost to include a DirectoryIndex setting.

Regards,
Garvin

Posted: Thu Jan 13, 2005 7:20 pm
by cptnwinky
I would love nothing more than to patch it up, only I don't know how that is why I came here asking for help.

I can moderatly understand the REGEX for the rewrite rules in the .htaccess file however most of whats in that file is foreign to me, I just don't understand what to fix.

Posted: Thu Jan 13, 2005 7:24 pm
by garvinhicking
Then please past your .htaccess file and I'll try to patch it up. Also look out if you have more .htaccess files in your subdirectores. I may also need the virtualhost configuration from your apache configuration to tell you how to fix things.

The regexps in .htaccess are not neccessary. Only the two directives I talked about...they seem to point to a wrong directory/file.

Regards,
Garvin

Posted: Thu Jan 13, 2005 7:45 pm
by cptnwinky
Here is the .htaccess file for the root directory which can be reached via http://www.civilissues.com/

Code: Select all

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php
php_value session.use_trans_sid 0
php_value register_globals off

RewriteEngine On
RewriteBase /
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [L,QSA]
RewriteRule ^PAT_ARCHIVES_SHORT index.php?url=/archives/$1-short.html [L,NC,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 ^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
I do have a .htaccess file in a sub-directory that is named cptnwinky, for the domain http://www.cptnwinky.com/ however this domain uses the latest stable version of Serendipity and does not suffer from this problem, rather than mod_rewrite it uses the error handling option.

Other than that the other sub-directories have no .htaccess files of their own.

I do not have access to the virtualhost config as this is a paid host environment. If it's necessary though I can write the host and ask them for a copy.

Thanks for your help.

Posted: Fri Jan 14, 2005 10:43 am
by garvinhicking
There, it's as I told you:

Code: Select all

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php
This tells that if you request a link off a subdirectory without a file, your browser will redirect you to /index.php.

Put a .htaccess in your subdirectory with this:

Code: Select all

ErrorDocument 404 index.php
DirectoryIndex index.php
You may need to adjust "index.php" to the index file actually inside the subdirectory...

Regards,
Garvin

Posted: Mon Jan 24, 2005 9:54 pm
by cptnwinky
Thanks for your replies. I did not recieve any email notification of your last reply so I did not know you did reply. That last one worked, I was leaving the forward slash infront of index.php on the sub-folders, so that worked beautifully.

Thanks for this great software and all your help.

Dave