Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 2nd, 2008, 06:20 AM
Krypton Krypton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 3 Krypton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 59 sec
Reputation Power: 0
mod_rewrite - Wildcard DNS dynamic subdomain

Hey there.

Hopefully somebody can help me, i want it so when people goto dynamicuser.domain.com it redirects them to there profile page e.g. the profile pages are stored in public_html/user/dynamicuser.php and i want it so when a user goes to dynamicuser.domain.com it redirects them to the dynamicuser.php file (thier profile).

I've experimented with alot of different codes but none so far have worked, i have wildcard dns enabled also so i was wondering if anyone has any ideas

THanks

Reply With Quote
  #2  
Old July 2nd, 2008, 07:50 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,790 jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 2 h 37 m 42 sec
Reputation Power: 1059
Welcome to Dev Shed.

Did you search the forums or even page one of the current list of threads in this forum? There's an answered request for something similar about ten or twelve posts down. Start with that, add the MOD REWRITE sticky in this forum, modify for your needs, and post what you come up with.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #3  
Old July 5th, 2008, 05:58 AM
Krypton Krypton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 3 Krypton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 59 sec
Reputation Power: 0
Sorry that was my first post.

I read through the mod_rewrite sticky and looked at a couple of other posts and have come up with this -

Code:
Options +FollowSymLinks 

RewriteEngine On 

RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{HTTP_HOST} ^([^\.]+)\.tutorialwave\.com$ [NC] 
RewriteCond %1 !^(www|ftp|mail)$ [NC] 
RewriteRule .* /profile.php?username=%1 [QSA,L]


When i try this it comes up with 'Internet Explorer Cannot Display This Page' and the URL shows as

josh.tutorialwave.com/user/user/user/user/user/user/user/user/user/user/josh.php

Not sure why this is happening!

Reply With Quote
  #4  
Old July 17th, 2008, 09:11 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,790 jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level)jharnois User rank is General 1st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 4 Days 2 h 37 m 42 sec
Reputation Power: 1059
You said you wanted it to go to /user/$name.php, but your RewriteRule is rewriting to /profile.php?username=%1 ... is there a typo there or something?

When a user access foo.domain.com, do you want to redirect to domain.com/user/foo.php or rewrite to foo.domain.com/user/foo.php?

Reply With Quote
  #5  
Old August 5th, 2008, 12:57 AM
Krypton Krypton is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 3 Krypton User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 10 m 59 sec
Reputation Power: 0
This is my final solution which works!

Code:
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.tutorialwave\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.tutorialwave\.com$ [NC]
RewriteRule ^$ /user/%2.php [QSA,nc]

Reply With Quote
  #6  
Old December 29th, 2009, 12:08 AM
seanincali seanincali is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 81 seanincali User rank is Lance Corporal (50 - 100 Reputation Level)seanincali User rank is Lance Corporal (50 - 100 Reputation Level)seanincali User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 10 h 40 m 13 sec
Reputation Power: 9
Send a message via ICQ to seanincali
im trying this way and its not really working for me. I want to make subdomains based on usernames on my site. It will be pulling them from a mysql database, table/username field.

Right now i have a script that calls profiles as /profile.php?user=$1

im trying this code below to make the subdomain but its not working, any ideas?

RewriteEngine on
Options +FollowSymLinks


RewriteCond %{HTTP_HOST} !^www\.mysite\.net$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.mysite\.net$ [NC]
RewriteRule ^$ /profile.php?user=$1 [QSA,nc]

Reply With Quote
  #7  
Old December 29th, 2009, 02:12 AM
seanincali seanincali is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 81 seanincali User rank is Lance Corporal (50 - 100 Reputation Level)seanincali User rank is Lance Corporal (50 - 100 Reputation Level)seanincali User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 10 h 40 m 13 sec
Reputation Power: 9
Send a message via ICQ to seanincali
what works for me on windows/apache 2.2 is



# .htaccess in DocumentRoot (Apache 2.x)
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.site\.net$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.site\.net$ [NC]
RewriteRule ^$ http://www.site.net/profile.asp?user=%2 [L]

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite - Wildcard DNS dynamic subdomain


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap