Howto: create homepages and 'subdomains' per user

16 years 6 months ago #48043 by ViriiGuy
very nice indeed!

Post edited by: ViriiGuy, at: 2007/10/16 20:01

Please Log in to join the conversation.

16 years 3 months ago #52929 by Shronk
Hi there,

I've created a homepage in a subfolder and included the redirect domain.com/USERNAME
this actualley worked perfectly well. However, I've just redirected my domain into the subfolder (so visitors will get directly into the subfolder and get the adress like: domain.com instead of domain.com/subfolder )

Now my problem is, that the redirect won't work anymore :(

Here's my htaccess file:
[code:1]# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
DirectoryIndex index.htm index.html default.htm default.htm
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName ******.***.***.ch
AuthUserFile /home/www/***/html/_vti_pvt/service.pwd
AuthGroupFile /home/www/***/html/_vti_pvt/service.grp


RewriteEngine On
RewriteOptions MaxRedirects=10
DirectoryIndex index.php
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?option=com_comprofiler&task=userProfile&user='$1'&Itemid=38 [L]

RewriteCond %{http_host} ^www\.matterhorny\.ch [nc]
RewriteRule ^(.*)$ matterhorny.ch/$1 [r=301,nc][/code:1]
(replaced some information with ***)

I've also included a rewrite to get rid of the www. (this shouldn't be the problem as it did work well before.)

Any help would be great.

My error that I'm getting is a 404:
The requested URL /Shronk was not found on this server.

Apache/1.3.36 Server at matterhorny.ch Port 80

Post edited by: Shronk, at: 2007/12/22 04:42

Please Log in to join the conversation.

16 years 3 months ago #52998 by Shronk
fixed my problem :) I've just had to put the htaccess into the subfolder and everything went well :)

Post edited by: Shronk, at: 2007/12/23 22:22

Please Log in to join the conversation.

16 years 2 months ago #54910 by norbee_89
This only works on linux servers? On IIS how can i use this technique ?? I reffer to the dns settings, subdomains doesnt works:((

Please Log in to join the conversation.

16 years 2 months ago #56898 by benblee
Easy directions for Dreamhost users:

This might help a little bit for those of you who get freaked out when it comes to changing code on files that you are usually told to stay away from (I'm talking to me!).

I use Dreamhost so I checked on the DNS stuff and I also checked on the Mod_Rewrite stuff. All clear if you are on Dreamhost. Here's a link to their wiki with an explination: wiki.dreamhost.com/Mod_rewrite


Now just open your .htaccess file (like Trail explained). I used a little bit different format when entering everything in because I wanted to be able to easily undo it if things did not go as planned. Here's all I did:

Find:

########## End - Joomla! core SEF Section


And insert the following right after:

########## Domain User Homepage SubDir Rewrite
#
DirectoryIndex index.php
RewriteBase /
RewriteCond %{HTTP_HOST} ([^/]+)\.domain\.com [NC]
RewriteCond %1 !www$ [NC]
RewriteRule ^(.*)$ www.domain.com/%1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?option=com_comprofiler&task=userProfile&user='$1' [L]
#
########## End domain User Homepage SubDir Rewrite


Replace "domain" with "yourdomainname" and that means no extra periods, slashes, comas or anything else.

Upload the .htaccess file to the root directory and you're set.


Thanks a ton to the original contributer "djTrail"!!!

Blue Skies!
benblee

Please Log in to join the conversation.

16 years 2 months ago #56924 by benblee
I did notice that after applying this to my site, if you go to a folder that should not be viewed and has an index.html file in it for that purpose, the file is bypassed and the directory is shown with some files being able to be viewed.

example:
www.yourdomain.com/username -- works
www.yourdomain.com/components -- shows the directory after implemented but not before
www.yourdomain.com/components/index.html -- does not show the directory

Is there a way to insure that this directory is not shown and still use this function?

Blue Skies!
benblee

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.233 seconds

Facebook Twitter LinkedIn