Forum Moderators: phranque
I want example.com to show example.com/home, but anything.example.com to stay at example.com.
Any help will be appreciated.
Here is my current .htaccess:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
This just forces no www.
Edit:
I have tried adding
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ http://example.com/home/$1 [L] [edited by: jdMorgan at 2:48 pm (utc) on Nov. 27, 2007]
[edit reason] example.com [/edit]
Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
#
# Externally redirect to canonical example.com domain
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
#
# Externally redirect to "/home" subdirectory
RewriteCond %{HTTP_HOST} ^example\.com
RewriteCond $1 !^home/
RewriteRule (.*) http://example.com/home/$1 [R=301,L]
Personally, I would recommend an internal rewrite instead of an external redirect if your goal is simply to organize the the site's files into a subdirectory. That is, the URL remains example.com/ while the files are actually located at the filepath /users/domain/html/home (example only, actual filepath depends on your server config).
Jim