My friend would like to change her domain oldsite.com to newsite.com.
The hosting company is lukrativedomains and they suggested changing the domain to newsite.com and then forwarding oldsite.com to newsite.com
However, the forwarding feature they offer will redirect all pages to the root newsite.com. I want to be able to forward all the individual pages of oldsite.com to the same page on newsite.com
Do I need to copy the content from oldsite.com to newsite.com and then implement a 301 redirect? If so, how do I do that and would that be duplicate content?
Also, how would I go about doing the 301 redirects for each page? What do I need from her? (htaccess? if so where would that be?)
As of right now, newsite.com does not have anything on it, it is just a parked page but I want it to look exactly like oldsite.com.
It is very important to do this while minimizing effects on SEO. She does not use wordpress, in fact, I am not really sure where the content lives (I am guessing on ftp somewhere)
here are my steps that i would do in this case
Create a full site backup (files and databases)
Upload them to the new site and check that everything works fine.
In the root folder (usually if you are using Cpanel that would be the public_html folder) i would create and .htaccess file with the 301 redirections
Code example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^oldpage.html$ http://www.newsite.com/newpage.html [R=301,L]
</IfModule>
Take a good look at the 3ed line whats going on,
I say RewriteRule and then "^" and the name of the page, that looks like in full url like this: http://www.oldsite.com/oldpage.html
So for example lets say that you want to redirect this url:
http://www.oldsite.com/categories/business/news.html
You would put it like this:
RewriteRule ^categories/business/news.html$ http://www.newsite.com/categories/business/news.html [R=301,L]
If it does not end with .html .php it would look like this:
RewriteRule ^categories/business/news/$ http://www.newsite.com/categories/business/news/ [R=301,L]
Also if you would like to learn a bit more about redirections i would suggest reading this article: http://moz.com/learn/seo/redirection
Related
I have a mirrored site and I need all the visitors to be redirected to a certain page other than the original homepage. But the original site (not the mirror) should continue to behave without changes. Therefore, I need to include a redirect rule in my .htaccess based on the referrer. If the visitor targets the mirrored site, I need to redirect. If the visitor lands at the original site, nothing should be done.
How do I implement this?
If you have the following setup:
fancysite.com - your main site with all the pages
coolname.com - a site that should redirect all requests to your main site
For example, a user requesting www.coolname.com/infos/january.html should be redirected to www.fancysite.com/infos/january.html.
This redirect should be done with a 301 HTTP response (moved permanently) for several reasons, e.g. google preferring it.
To do this on an Apache server, you put a .htaccess file in the root directory of your website (may differ from the root of your account). The server must have the module mod_rewrite and you must have the rights to use it.
Put the following in your .htaccess to redirect all requests, as you do not want to update it for every new page you put on your site:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !fancysite.com$ [NC]
RewriteRule ^(.*)$ http://www.fancysite.com/$1 [L,R=301]
The module mod_rewrite is very powerful, have a look at the documentation, if you have the time:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
I have a shared host. Default url, www.mywebsite.com, on that host points to public_html directory. I have build a new directory, wordpress, under public_html. And i want to redirect my users to the wordpress directory. But i don't want to show /wordpress/ pathname on address bar.
What i have tried until now with .htacces puts the /wordpress/ pathname on address bar like www.mywebsite.com/wordpress/. However i want to show www.mywebsite.com even if it was redirected to the wordpress subdirectory.
In general you just point it using .htaccess but I think there are other considerations as well. There is already an article from wordpress on how to do this as this is a very common thing. That is the best place to start is on wordpress' site.
In the htaccess of the root, you should be able to do a simple rule like this.
RewriteEngine On
RewriteRule ^/?$ /wordpress [L]
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
I had to adjust some paths on my site and I need to use .htaccess to redirect the items on the chance a user accesses the old url.
For example my old urls (relative) could be:
/old-path/page1.php
/old-path/page2.php
/old-path/page3.php
etc...
I had to change the path (for this example) to new-path and I need to adjust the .htaccess so anyone that comes to any page with .../old-path/... will be redirected to
.../new-path/...
Also, would this satisfy the 301 or would I need to list out each page?
You can use either mod+alias:
Redirect 301 /old-path /new-path
or using mod_rewrite:
RewriteEngine On
RewriteRule ^/?old-path/(.*)$ /new-path/$1 [L,R=301]
These could be in the htaccess file in your document root or in the server/vhost config. If you already have rewrite rules somewhere, you may just want to stick with mod_rewrite because redirecting with mod_alias while using mod_rewrite can sometimes give conflicting results.
So I've been looking but so far can;t find something that I'm looking for exactly. Looked at this article How can I forward ALL pages to the same exact page on a different domain using .htaccess? but it seems to only redirect my home page.
Currently, I'm using WordPress and I need to be able to forward all pages to a new domain. For example, domain1.com/about-us needs to go to domain2.com/about-us. But I have about 50 pages this needs to work on. I would like to see if there is a 1-5 line code to use for this to work.
Thanks!
Try putting this (above any wordpress rules) in the htaccess file in domain1.com's document root:
RewriteEngine On
RewriteCond %{HTTP_HOST} domain1.com [NC]
RewriteRule ^(.*)$ http://domain2.com/$1 [L,R=301]
If your 2 domains are one different webservers, or don't share a common document root, you can just use mod_alias, adding this to the htaccess file in domain1.com's document root:
Redirect 301 / http://domain2.com/
I'm trying to get a set of 301 redirects working for a client site, and I'm getting a bit stuck.
I have about 17 different directories that have .html content fileswhich I am moving across to Wordpress. What I am trying to do is create a simple, single .htaccess file with redirects in that will allow me to redirect all the .html files within a directory to wordpress URLs without an extension:
Manual redirect example:
redirect 301 /blog/2009/04/post1.html /blog/2009/04/post1/
redirect 301 /blog/2009/04/post2.html /blog/2009/04/post2/
Trying to create a rule like:
RewriteRule ^/blog/2009/04/(.*?).html$ /blog/2009/04/$1/ [R=301,NC,L]
Where the $1 is the filename (minus the .html) suffixed with a /
I can't determine whether the ^/blog/2009/04/(.*?).html$ means it will only redirect for this particular directory, and will redirect to the right location.
I would obviously want to duplicate this ReWriteRule for all my designated content directories...
Can anyone point me in the right direction?
Thanks,
Lee
Yes, your rule will only redirect for the 2009/04 directory. I think you want:
RewriteRule ^/blog/([0-9]+)/([0-9]+)/(.*?).html$ /blog/$1/$2/$3/ [R=301,NC,L]
This will now also redirect /blog/2008/12/post.html to /blog/2008/12/post/ and so on. Although since you have almost exactly the same format, maybe this will be easier?
RewriteRule ^/blog/(.*?).html$ /blog/$1/ [R=301,NC,L]