Hello, I want to use 301 redirect to redirect a directory to another URL. For example, let's say that the directory I want to redirect is mydomain.com/dir1 and I want to redirect it to http://forums.digitalpoint.com/ My question is: Should I create a .htaccess file that contains redirect 301 /dir1 http://forums.digitalpoint.com/ Code (markup): and place it in the main root directory of my site (mydomain.com) or I could create a .htaccess file with the following code redirect 301 / http://forums.digitalpoint.com/ Code (markup): and place it in the directory mydomain.com/dir1 ?
You don't need to do something in your root,just create add the following code to .htaccess file in your directory folder. redirect 301 /dir1 http://forums.digitalpoint.com/ Code (markup):
You mean that I should place the .htaccess file in the directory mydomain.com/dir1 (in my example above)? If so, wouldn't the "/dir1" in the redirect code mean: "look for the directory named dir1 in the current directory (mydomain.com/dir1 - which has the .htaccess file) i.e. look for mydomain.com/dir1/dir1 and redirect it to http://forums.digitalpoint.com/"? Did I get it wrong?!
Oh,sorry buddy,typo! The code should be redirect / http://forums.digitalpoint.com Code (markup): then place the .htaccess file in the dir1 folder.. Option 2: Add the following code to .htaccess file located in the root redirect /dir1 http://forums.digitalpoint.com Code (markup): I think either way is okay! Let me know if it works!