Amanada Smith
Amanada Smith

Reputation: 1981

Rewrite configure to redirect directory to subdomain

I have domain.com/forums but I need help redirecting the forums to sub.domain.com

Below works but I end up with

sub.domain/forums/topic-name-here

RewriteEngine on
RewriteRule ^(.*)$ http://sub.domain.com/$1 [R=301,L]

Upvotes: 0

Views: 64

Answers (1)

Alexander Randa
Alexander Randa

Reputation: 868

Try this:

RewriteEngine on
RewriteCond %{REQUEST_URI}  ^\/?forum\/.* 
RewriteRule ^\/?forum\/(.*)$ http://sub.domain.com/$1 [R=301,L]

P.S. i using "/?" because i forget REQUEST_URI format :(

Upvotes: 1

Related Questions