Forum Moderators: phranque

Message Too Old, No Replies

.htaccess subdomain simulation

RewriteCond problem

         

n0sferat0

10:17 am on Apr 25, 2006 (gmt 0)



I am working on a site on which every user has a user's page thant can be accessed /index.php?page=mypage&user_id=...

I want to make it possible for a user to access his or her page as if it were a sub domain of the site's domain
(example: [username.sitedomain.com...] )
for this i need to send all requests that have some subdomain in front to a php file that parses the given adress and redirects to the users my page.
I have tried writeing in .htaccess, something like this, but it doesn't work, pls help me:

RewriteCond %{HTTP_HOST} ^subdomaintest.sitedomain.com$
RewriteRule ^(.*)$ [sitedomain.com...] [R]

which for an url of type [subdomaintest.sitedomain.com...]
should redirect to handle.php in the site root

jdMorgan

3:11 pm on Apr 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



n0sferat0,

Welcome to WebmasterWorld!

> but it doesn't work

Please be more specific:

  • How did you test?
  • What were the results?
  • How did those results differ from your expectations?
  • Did you get a 500-Server Error?
  • If so, what was in your server error log.
  • Do you have any other working RewriteRules?
  • If not, have you tried a simpler test, like "RewriteRule ^foo\.html$ /index.php [L]"?

    Note that you probably do not want to redirect here, you just want to internally rewrite the request to the script.

    Jim

  •