Forum Moderators: phranque

Message Too Old, No Replies

.htaccess problem

redirect my forum to subdomain

         

weely

9:22 am on May 27, 2009 (gmt 0)

10+ Year Member



hi i am new and i read many thread here but still dont get what i want

i have a vb forum (http://www.example.com/vb)

i have a vbseo installed

i transfer forum to (http://vb.example.com)

i use the .htaccess as below
---------------------
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^ http://vb.example.com$1 [R=301,L]

---------------------

will it work fine but when i wana access old thread found in google like

http://example.com/vb/forum13/

it redirct me to (http://vb.example.com) agian !

i dont wana lose visitors i want

http://example.com/vb/forum13/

goes to

http://vb.example.com/forum13/

any one know how to do that ?

[edited by: jdMorgan at 6:16 pm (utc) on May 27, 2009]
[edit reason] example.com [/edit]

weely

2:25 pm on May 27, 2009 (gmt 0)

10+ Year Member



anyone ?

jdMorgan

3:23 pm on May 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your server is apparently doing exactly what you told it to do.

How is mod_rewrite supposed to determine the difference between a URL that you *do* want to redirect, and one that you *do not* want to redirect? In general, mod_rewrite can only act based on information received in the HTTP request from the client. So what are the differences between these two kinds of URLs?

By the way, this is not instant messaging. The number of requests here is relatively high, and the number of contributors is relatively low. Also, please be aware that many of us are in different time zones. Please allow some time for replies.

Jim

weely

4:02 pm on May 27, 2009 (gmt 0)

10+ Year Member



i am sorry

i just want to make

http://example.com/vb/whatever
goes to
http://vb.example.com/whatever

so that

http://example.com/vb/xyz
goes to
http://vb.example.com/xyz

and

http://example.com/vb/aaa
goes to
http://vb.example.com/aaa

i hope you know what i mean i see it in many others forums but no one wana help me :(

[edited by: jdMorgan at 6:19 pm (utc) on May 27, 2009]
[edit reason] example.com [/edit]

jdMorgan

6:14 pm on May 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Then all you need is to capture and use the requested URL-path (as $1) in the substitution URL:

RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule [b]^(.*)$[/b] http://vb.example.co[b]m/$1[/b] [R=301,L]

Jim

jdMorgan

6:21 pm on May 27, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or depending on where the .htaccess file containing this code is located, you may need:

RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^vb/(.*)$ http://vb.example.com/$1 [R=301,L]

Jim

[edited by: jdMorgan at 6:21 pm (utc) on May 27, 2009]