Forum Moderators: phranque
What I want to do is very common and probably very easy to do:
I want http://www.example.com/forum to be http://forum.example.com
I have a htaccess in my main directory that is set up like this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain.example.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule ^(.*) http://%{HTTP_HOST}/subdomain/$1
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule ^(.*) http://%{HTTP_HOST}/subdomain/$1
When I go to http://forum.example.com it redirects to http://forum.example.com/forum. How can I make it simple http://forum.example.com?
Thanks!
[edited by: jdMorgan at 4:37 am (utc) on Oct. 6, 2007]
[edit reason] example.com [/edit]
RewriteEngine On
#
RewriteCond %{HTTP_HOST} ^(www\.)?subdomain\.example\.com
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1 [L]
Well I replaced my htaccess code with what jdMorgan wrote and now it pulls a 404 error.
Here's how my files on the server are set up:
public_html>>subdomain
I also tried putting a "subdomain" folder in the main directory, no dice. Any idea what I'm doing wrong?
Like I said earlier, my previous htaccess code would work but bring up "subdomain.domain.com/subdomain" instead of just "subdomain.domain.com".
Thanks!