You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Norman Khine <no...@khine.net> on 2010/08/20 15:16:07 UTC

[users@httpd] rewrite redirect advise

hello,
i have a drupal site within which there is a folder with wordpress so
http://mysite/blog loads the wordpress.

i want to take this out completely so the http://blog.mysite is in its own vhost

is it possible in for the http://mysite to add a rewirite so that if a
user types http://mysite.com/blog it is rewritten to
http://blog.mysite.com

i have this:
# Various rewrite rules.
<IfModule mod_rewrite.c>

  RewriteCond %{HTTP_HOST} ^mysite\.com\/blog$ [NC]
  RewriteRule ^(.*)$ http://blog.mysite.com$1 [L,R=301]

is this correct way to do this?

thnks
-- 
˙uʍop ǝpısdn p,uɹnʇ pןɹoʍ ǝɥʇ ǝǝs noʎ 'ʇuǝɯɐן sǝɯıʇ ǝɥʇ puɐ 'ʇuǝʇuoɔ
ǝq s,ʇǝן ʇǝʎ
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] rewrite redirect advise

Posted by Matus UHLAR - fantomas <uh...@fantomas.sk>.
On 20.08.10 15:16, Norman Khine wrote:
> i have a drupal site within which there is a folder with wordpress so
> http://mysite/blog loads the wordpress.
> 
> i want to take this out completely so the http://blog.mysite is in its own vhost
> 
> is it possible in for the http://mysite to add a rewirite so that if a
> user types http://mysite.com/blog it is rewritten to
> http://blog.mysite.com

I think that simple directive should work:
Redirect temp /blog http://blog.mysite.com/

Well, if you expect people put anything after the /blog, this will redirect
/blogger to blog.mysite.comger , to avoid this you can use:

RedirectMatch temp ^/blog$ http://blog.mysite.com/
RedirectMatch temp ^/blog/(.*) http://blog.mysite.com/$1

I hope it's clear enough.

> i have this:
> # Various rewrite rules.
> <IfModule mod_rewrite.c>
> 
>   RewriteCond %{HTTP_HOST} ^mysite\.com\/blog$ [NC]

the HTTP Host: will NEVER contain the "/blog" part.

>   RewriteRule ^(.*)$ http://blog.mysite.com$1 [L,R=301]
> 
> is this correct way to do this?

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
If Barbie is so popular, why do you have to buy her friends? 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org