user url rewrite

Discuss practical ways rearrange URLs using mod_rewrite.

user url rewrite

Postby acctman » Sun Aug 17, 2008 10:36 pm

currently my users have urls like the www.domain.com/user/UserName.html i want them to be able to use USERNAME.domain.com as well
acctman
 
Posts: 5
Joined: Tue Jul 29, 2008 4:13 pm

Postby richardk » Mon Aug 18, 2008 4:55 pm

FAQ: Virtual sub domains.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Rewrite sub domains.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC]
RewriteRule ^$ /user/%2.html [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby acctman » Tue Aug 19, 2008 12:34 am

thanks.
acctman
 
Posts: 5
Joined: Tue Jul 29, 2008 4:13 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 5 guests

cron