Log in

View Full Version : .htaccess rewrite url problem



robert_gsfame
08-26-2010, 02:20 PM
I try to create a virtual subdomain by rewriting url in .htaccess
below is the code

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.mydomain.co.id$ [NC]
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).mydomain.co.id [NC]
RewriteRule (.*) page.php?username=%1 [L]
</IfModule>
ErrorDocument 404 /page_error.html

the problem is that when i try this www.aaaaa.mydomain.co.id , i will then redirected to default web page cgi-sys... but once i try aaaaaa.mydomain.co.id then i will have this SERVER NOT FOUND

i really dont have anymore idea on how to solve this problem, hope that anyone could come up with a solution

thx in advance

traq
08-26-2010, 07:06 PM
never tried it, but have you tried first rewriting all non-www urls with the www? So, in effect, if I typed sub.example.com, it would redirect to www.sub.example.com and then to the user page?

robert_gsfame
08-27-2010, 02:27 AM
nope cause i dont have any idea on how to do it

i am new to .htaccess, could you point me out??

traq
08-27-2010, 05:07 AM
I know a good htaccess tutorial - let me find it, and I'll try out some rules too.