redirect subfolder to new domain ?

  • basimfora
  • Born
  • Born
  • basimfora
  • Posts: 1

Post 3+ Months Ago

hello
I need redirect domain.com/subfolder to subdomain.newdomain.com

in same time I want redirect domain.com to newdomain.com

how can I do that ?


thanks so much in advance for any help
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Truce
  • Guru
  • Guru
  • Truce
  • Posts: 1477
  • Loc: Washington DC

Post 3+ Months Ago

PHP Code: [ Select ]
<?
 
header("Location: http://subdomain.example.com/<!-- m -->");
exit;
 
?>
  1. <?
  2.  
  3. header("Location: http://subdomain.example.com/<!-- m -->");
  4. exit;
  5.  
  6. ?>


Apache or Lighttpd can do this too...and while it's more appropriate (status codes and such), this gets the job done for what is likely a tiny website.
  • joombler
  • Born
  • Born
  • joombler
  • Posts: 2

Post 3+ Months Ago

basimfora wrote:
I need redirect domain.com/subfolder to subdomain.newdomain.com
in same time I want redirect domain.com to newdomain.com


open the .htaccess file in your docroot and add

Redirect 301 / http://www.newdomain.com/
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

If this is Apache, create the directory named "subfolder" if it doesn't already exist, then create an htaccess file in there.

You do it this way so that the conditions are only checked when the request is inside of that folder. If you use Redirect/RewriteRule in the DocuemntRoot, those conditions will get checked for nearly every, if not every, request made to the website.
That would be like stopping for a split second to find out if you are in the bathroom every time you are about to take a step anywhere in the building.

From there, this thread should be of some help.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 79 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.