Directory index and parent directory.

Using a single web hosting account to host multiple sites

Directory index and parent directory.

Postby itoje » Sun Aug 20, 2006 10:24 am

Hello!

I have a domain named here as domain.com and all files are in my home directory ~<userName>/sites/domain.com/www/.

I have also subdomain (made by .htaccess under www-directory) which works fine but if I have an empty directory without index-file then the directory listing page's title is wrong and also the "Parent Directory" link points to wrong location.

I have under www-directory:
subdomains/sd
subdomains/sd/dir1

dir1 doesn't contain anything.

If I write to browser http://sd.domain.com/dir1 it shows the directory listing with title: Index of /subdomains/sd/dir and the Parent Directory links to http://sd.domain.com/subdomains/sd. Browser's location bar is correctly http://sd.domain.com/dir1.

What should I do to get the title to be "Index of /dir1" and the parent link to "http://sd.domain.com/"? I hope you get what I mean! :)

.htaccess-file under www:
RewriteEngine on
# wrong subdomains -> domain.com
RewriteCond %{HTTP_HOST} !^domain\.com [NC]
RewriteCond %{HTTP_HOST} !^sd\.domain\.com [NC]
RewriteRule ^(.*) http://domain.com [R]

# sd.domain.com
RewriteCond %{HTTP_HOST} ^sd\.comain\.com [NC]
RewriteCond %{REQUEST_URI} !^/subdomains/sd
RewriteRule ^(.*)$ /subdomains/sd/$1


.htaccess-file under www/subdomains/sd:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ http://%{HTTP_HOST}/$1/ [R]



Thanks!
itoje
 
Posts: 2
Joined: Sun Aug 20, 2006 9:47 am

Postby richardk » Sun Aug 20, 2006 11:35 am

You can't without making your own directory listing script for use with more mod_rewrite code.

The best thing to do is setup subdomains properly with a <VirtualHost> block.

Edit: you should make your R flags R=301 flags.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby itoje » Mon Aug 21, 2006 1:07 pm

<VirtualHost> block seems to be in server config file and I don't have access to it. I think I will be fine with this configuration and just place index-files under those few subfolders and use generic error page for resources not found.

Thanks for the advice!
itoje
 
Posts: 2
Joined: Sun Aug 20, 2006 9:47 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 26 guests

cron