0

I had subdomain like m.domain.com and now I removed it and changed the website to responsive. Now I want to redirect all not found url's of m.domain.com to domain.com like below urls

m.domain.com/categoryname/post/ to domain.com/categoryname/post/
m.domain.com/category/categoryname/ to domain.com/category/categoryyname/post/ 
m.domain.com/tag/tagname/ to domain.com/tag/tagname/

Please somebody help me with rewriting rules for correct redirection.

1 Answers1

0

You can create a 404 page or 301 redirect or

<?php
// Permanent redirection
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com");
exit();
?>

write the above code in your previous subdoamin website page . for the location write your new address. first it will load to your previous domain then automatically return to new url you have written.

goto this page of yours m.domain.com/categoryname/post/ then write above code inside that page with location domain.com/categoryname/post/ .

Also check out this question.

Or you can also change it through your host.

Community
  • 1
  • 1
SMK
  • 324
  • 3
  • 14