Current location: Hot Scripts Forums » Other Discussions » Web Servers » [SOLVED] Giving users fake subdomains + root directory?


[SOLVED] Giving users fake subdomains + root directory?

Reply
  #1 (permalink)  
Old 09-10-08, 07:41 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
[SOLVED] Giving users fake subdomains + root directory?

Im in need of some sort of .htaccess code to give users there own subdomain.
Iv had ago at it:

Code:
<IfModule mod_rewrite.c>

	# Start Rewrite Engine with FollowSymLinks
	Options +FollowSymLinks
	RewriteEngine On

	# Subdomain + Clean Urls
	RewriteCond %{HTTP_HOST} !www\.example.co.nz$ [NC]
	RewriteCond %{HTTP_HOST} ^(www\.)?([_a-z0-9-]+)\.example.co.nz[NC]
	
	RewriteRule ^(.*)$ route.php?route=%2/$1 [L,QSA]

</IfModule>
I cant get images, css, js files ect on these subdomain pages...
These are not 'real' subdomains... iv set only one subdomain which points to the /public_html/ folder:

Code:
 *.example.co.nz - document root: home/public_html
So why cant i get images, css...? What do i do?

I would like to make it route all subdomain request to like this:

Code:
URL: http://www.test.example.co.nz/hello/world
ROUTE: http://www.example.co.nz/user/view/test/hello/world
Help me??

Thanks guys,
Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #2 (permalink)  
Old 09-15-08, 03:29 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Well i figured it out lol
Code:
<IfModule mod_rewrite.c>

	# Start Rewrite Engine with FollowSymLinks
	Options +FollowSymLinks
	RewriteEngine On

	# Subdomain requests
	RewriteCond %{HTTP_HOST} !www\.example.co.nz$ [NC]
	RewriteCond %{HTTP_HOST} ^(www\.)?([_a-z0-9-]+)\.example.co.nz [NC]
	RewriteRule ^([a-zA-Z0-9_]+)$ $1?subdomain=%2 [QSA]
	
	# Subdomain index page
	RewriteCond %{HTTP_HOST} !www\.example.co.nz$ [NC]
	RewriteCond %{HTTP_HOST} ^(www\.)?([_a-z0-9-]+)\.example.co.nz [NC]
	RewriteRule ^$ newsletters?subdomain=%2 [QSA]

	# Clean Url effected images/
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule .*images/(.*)\.(jpg|gif|png)$ images/$1.$2 [L,QSA]
	
	# Clean Urls
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	
	RewriteRule ^(.*)$ route.php?route=$1 [L,QSA]
    
</IfModule>
Any changes i should know about?

Thanks,
Lex
__________________
01010000 01001000 01010000
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
authenticate Active Directory Users wajeeh_r ASP 5 04-27-09 11:36 AM
php.ini root directory xavier039 PHP 1 01-07-07 02:51 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM
? on users accessing a directory mdhall PHP 10 10-18-03 12:25 PM


All times are GMT -5. The time now is 01:28 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.