Rewrite URL to dynamicuser.domain.com

Ask your mod_rewrite and Redirection questions here, and get answers!

Rewrite URL to dynamicuser.domain.com

Postby Krypton » 04 Jul 2008 07:12

Hi

Basically i have it so when users log in it goes to there user profile located at /user/dynamicuser.php and what i want to do is when they type dynamicuser.domain.com it goes to thier profile page. So far i have succeded by using the code

Code: Select all
RewriteEngine On

# Extract the subdomain part of domain.com
RewriteCond %{HTTP_HOST} ^([^\.]+)\.tutorialwave\.com$ [NC]

# Check that the subdomain part is not www and ftp and mail
RewriteCond %1 !^(www|ftp|mail)$ [NC]

# Redirect all requests to a php script passing as argument the subdomain
RewriteRule ^.*$ http://www.tutorialwave.com/profile.php?username=%1 [R,L]


But when it goes to thier profile page the URL still looks like domain.com/user/dynamicuser.php, i want it so that it still shows dynamicuser.domain.com so any ideas would be appreciated!!

Thanks
Krypton
 
Posts: 1
Joined: 04 Jul 2008 06:54

Return to Redirect or Rewrite Questions



Who is online

Users browsing this forum: clerkfurniture, HIBcokyacrornsap, ShakhtarrDon, VocrepeAcceby, Zitioutbava