I'm trying to rewrite my URL's subdomain.
http://username.domain.com will show content of http://www.domain.com/user.php?u=username but URL stay as http://username.domain.com . (I mean url masking)
(Username's can contain a-z 0-9 and hypens) Also if subdomain is www or api, don't redirect them
I'm using this for my .htaccess
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com
RewriteRule .* /user.php?u=%1 [L]
(After @mfarver's advice) I'm trying this
RewriteEngine on
RewriteRule .* /user.php?u=%1 [L]
but this time getting 500 Internal Server error:
[Mon May 30 20:10:44 2011] [alert] [client 81.6.xx.xxx] /home/blablabla/public_html/.htaccess: AllowOverride not allowed here
(from error log)
My server's httpd.conf file's virtualhost settings
<VirtualHost 109.73.70.169:80>
<IfModule mod_userdir.c>
UserDir disabled
UserDir enabled USERNAME
</IfModule>
<IfModule concurrent_php.c>
php4_admin_value open_basedir "/home/USERNAME/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
php5_admin_value open_basedir "/home/USERNAME/:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule !concurrent_php.c>
<IfModule mod_php4.c>
php_admin_value open_basedir "/home/USERNAME/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir "/home/USERNAME/:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule sapi_apache2.c>
php_admin_value open_basedir "/home/USERNAME/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
</IfModule>
</IfModule>
ServerName DOMAIN.net
ServerAlias *.DOMAIN.net
<Directory "/home/USERNAME/public_html">
Options FollowSymLinks
Allow from all
AllowOverride All
</Directory>
DocumentRoot /home/USERNAME/public_html
ServerAdmin webmaster@DOMAIN.net
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/DOMAIN.net combined
CustomLog /usr/local/apache/domlogs/DOMAIN.net-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User USERNAME # Needed for Cpanel::ApacheConf
<IfModule mod_suphp.c>
suPHP_UserGroup USERNAME USERNAME
</IfModule>
<IfModule !mod_disable_suexec.c>
SuexecUserGroup USERNAME USERNAME
</IfModule>
ScriptAlias /cgi-bin/ /home/USERNAME/public_html/cgi-bin/
# To customize this VirtualHost use an include file at the following location
# Include "/usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN.net/*.conf"
</VirtualHost>
Also *.DOMAIN.net added to my DNS ZONES as A record.