php - issue in redirecting 2 domains in one server -


i have 2 domains , both set on 1 server , when open each of them , same website same server opens . want redirect 1 of them . example have www.first.com , www.second.com both on 1 server , , want www.first.com redirected www.second.com . cannot make index redirect because both on 1 server need way creating htaccess file or . ( have tried redirect 301 , redirect 302 in htaccess didn't work )

you can use code in document_root/.htaccess file:

rewriteengine on  rewritecond %{http_host} ^(?:www\.)?first\.com$ [nc] rewriterule ^ http://www.second.com%{request_uri} [ne,r=301,l] 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

post - imageshack API cURL -