Forum Moderators: phranque
i want to rederict a folder to subdomain. i have looked in all the forum but nothing worked for me. what i want to do is : when user request a http://blog1.example.com --------> http://example.com/blog1 but in his browser he must have a http://blog1.example.com address it worked forme but like this way when i type blog1.example.com it redirect to http://blog1.example.com/blogs/blog1
im looking for some thing like wordpress htaccess style .
this is my .htaccess:
RewriteEngine on
RewriteBase /# If no-www domain requested, externally redirect to www domain
RewriteCond %{HTTP_HOST} ^example\.org
rewriterule (.*) http://www.example.org/$1 [R=301,L]
# If www+subdomain domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.example\.org
rewriterule (.*) http://%1.example.org/$1 [R=301,L]
# If subdomain+www domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.example\.org
rewriterule (.*) http://%1.example.org/$1 [R=301,L]
# If subdomain requested, rewrite home page requests to index.php with query string user=subdomain & page="home"
RewriteCond %{HTTP_HOST} !^www\.example\.org
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.org
rewriterule ^$ blogs/%1 [L]
and this the wordpress one : for who can make it work with sumple subdir :
RewriteEngine On
RewriteBase /
# Rewrite www.example.com to example.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [R,L]
#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
and thanks
AL
[edited by: jdMorgan at 9:09 pm (utc) on May 21, 2007]
[edit reason] Example.com, tidied-up [/edit]
# Rewrite www.example.com to example.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [R,L]
We need to know:
Try to provide as much information as possible in that order, changing only the domain name (use example.com).
Jim