Page 1 of 1

How? mod_rewrite ([a-Z]+)\.domain\.com to /index.php?name=$1

Posted: Thu Mar 15, 2007 12:22 am
by visonardo
How can i do it? i want that any subdomain that one write, ... (thus)

([a-Z0-9-]+)\.domain\.com --> index.php?name=$1


how can i do that?

i tested with this file

Code: Select all

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^([a-Z0-9])\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/index.php?nombre=$1 [P,L]


but dont work :S i have not created any subdomain, how can i do to that work with any and not be created handly each one? :?

Posted: Thu Mar 15, 2007 12:42 am
by visonardo
well, this .htaccess configuration that i shown, have something bad, because the server always showed me that

Code: Select all

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@domain.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.37 Server at domain.com Port 80
surely because the rewrite url wont rewrite the subdomain "www" when i wont see the site ? it appeared with http://domain.com just too