.htaccess - Redirect user to different site using apache rewrite rule -
i working on specific condition on production environment need redirect user third part in case specific url.
i aware rewrite rule can used case, came across redirect
in apache can used if resource moved server.
can 1 me understand correct way this, want use url 'www.mysite.com/some/optional parameter/testpage' , mysite.com/some/optional parameter/testpage
redirect http://testpage.mysite.com/
#with redirect redirect "www.mysite.com/testpage" "http://testpage.mysite.com/" redirect "mysite.com/testpage" "http://testpage.mysite.com/"
is correct way achieve or need take different approach.
you cannot use redirect
directive matching host name in request. better use mod_rewrite
, 301
redirect.
rewriteengine on rewritecond %{http_host} ([^.]+\.[^.]+)$ [nc] rewriterule (?:^|/)(thepact)/?$ http://$1.%1 [l,nc,r=301]