URL Rewrite + Subdomain rewriting

65 views
Skip to first unread message

matth

unread,
May 2, 2007, 11:25:03 PM5/2/07
to Apache .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC]
RewriteRule ^.?$ profile.php?user=%1 [L]
RewriteRule ^profile/(.*)$ profile.php?user=%1 [QSA,L]
RewriteRule ^profile/(.*)/(.*)$ profile.php?user=%1&nb=$2 [QSA,L]


I've had success rewriting my URLs in the past, but this has kicked my
butt. I'm able to have unique subdomains for each user, except I don't
know how to push this any further.

"username.example.com" works, however none of the other Rewrite rules
work unfortunately.

My goal is to end up with something like this:
"username.example.com/notebook/Programming"

Truly Stumped,
Matt

Apache Admin

unread,
May 10, 2007, 6:56:03 PM5/10/07
to Apache .htaccess
what is your file structure like?

Also you might have luck looking around htaccesselite.com and asking
there.

Reply all
Reply to author
Forward
0 new messages