Forum Moderators: phranque

Message Too Old, No Replies

A way to get my old domain pages to the new

         

iElle

1:58 pm on Dec 7, 2010 (gmt 0)

10+ Year Member



Hi, I have bought a new domain,but the older was in a good position on google, now what can I do for auto forwarding the users to the new site when they reach a thread of my forum?
For example a user go to [oldsite.com...] and automatically it will go to [newsite.com...]
PS. My site is a forum based on MyBB

jdMorgan

2:36 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Detect requests for the oldsite.com hostname, and generate a 301-Moved Permanently redirect to the same URL-path on newsite.com.

How you do this depends on whether the two domains are hosted on the same server and on what tools you have available to you.

In general, you can use mod_alias if the domains are NOT hosted on the same server or if you have direct access to the server configuration -- not likely on shared hosting.

If you do not have server config access and if the domains are hosted in the same account on the same server, then you will need to use mod_rewrite instead of mod_alias.

See the Apache mod_alias and mod_rewrite documentation at apache.org, and check out the resources cited in our Apache Forum Charter here at WebmasterWorld to get started.

Also, for good results, you will need to contact as many of your important linking partners as possible, and ask them to update their links to point to your new domain. You cannot rely on "just the redirect code" for best results. You *must* be sure to change all canonical links on your own pages to point to this new domain name.

Finally, DO NOT change anything else about the site or its URLs until all important search engines have fully updated the search listing for your site to point to the new domain. If you change the structure of the site or its URLs at the same time as changing the domain name, you can expect big trouble with search engine ranking.

Jim

iElle

3:05 pm on Dec 7, 2010 (gmt 0)

10+ Year Member



Where do i have to insert this 301 redirect? If i insert it do you think it will make all links to the new domain or it forward them to the correct page example oldsite.com/try.php redirect to newsite.com/try.php and oldsite.com/yeah.php redirect to' newsite.com/yeah.php ?
However my old site is a subdomain of altervista.org , a free web hosting service.

jdMorgan

4:52 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Generally, the code for the 301 redirect goes into a .htaccess file in the root directory of the site.

If you write the code properly, it will redirect oldsite.com/ to newsite.com/, oldsite.com/abc to newsite.com/abc, and oldsite.com/abc/def/ghi/xyz to newsite.com/abc/def/ghi/xyz -- all using only one or two lines of code.

See our Apache Forum Library. There are several threads there about simple redirects like this one.

Jim

iElle

6:25 pm on Dec 7, 2010 (gmt 0)

10+ Year Member



Ok but there is a little problem because i have already got an .htaccess that is used by google SEO( a mybb plugin) maybe if i edit the site link string with a new one it will work... I will try tonight

g1smd

6:58 pm on Dec 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you are redirecting requests, there shouldn't be an "old site" with pages that can be accessed there.

To be clear, the redirect goes at the domain that is no longer in use, and redirects requests for it to the new URL for that content.

This code cannot alter the links on your pages, you have to manually do that yourself.

iElle

9:18 am on Dec 8, 2010 (gmt 0)

10+ Year Member



I don't want alter links on my page, just redirect a page from the old domain to the new but i don't know how to make this code......Here is the code from mybbseo plugin of mybb:
# EXAMPLE .htaccess FOR MYBB WITH GOOGLE SEO URL
# -------------------------------------------------------------------
# This file is identical to MyBB's htaccess.txt example file,
# with rewrite rules for a standard Google SEO install added.
#
# Before using this file please make sure to:
#
# - replace /MyBB/ with your forum folder, e.g. / or /forum/
# - replace yoursite/MyBB with your forum URL
# - name the file '.htaccess' (starting with the dot, no .txt)
#
# Alternatively you can add the required rewrite rules to your
# existing .htaccess, the specific rules required will be displayed
# on the plugin status page once Google SEO URL is enabled.
# -------------------------------------------------------------------

Options -MultiViews +FollowSymlinks -Indexes

#
# If mod_security is enabled, attempt to disable it.
# - Note, this will work on the majority of hosts but on
# MediaTemple, it is known to cause random Internal Server
# errors. For MediaTemple, please remove the block below
#
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>

#
# MyBB "search engine friendly" URL rewrites
# - Note, for these to work with MyBB please make sure you have
# the setting enabled in the Admin CP and you have this file
# named .htaccess
#
<IfModule mod_rewrite.c>
RewriteEngine on

# Some hosts need a RewriteBase specification.
RewriteBase /

# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
RewriteRule ^([^&]*)&(.*)$ http://ps3mod.altervista.org/$1?$2 [L,QSA,R=301]

# Google SEO Sitemap:
RewriteRule ^sitemap-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]

# Google SEO URL Forums:
RewriteRule ^Forum-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]

# Google SEO URL Threads:
RewriteRule ^Thread-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]

# Google SEO URL Announcements:
RewriteRule ^Announcement-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]

# Google SEO URL Users:
RewriteRule ^User-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]

# Google SEO URL Calendars:
RewriteRule ^Calendar-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]

# Google SEO URL Events:
RewriteRule ^Event-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]

# Google SEO 404:
ErrorDocument 404 /misc.php?google_seo_error=404

# Default MyBB Rewrite Rules:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]

RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]

RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]

RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]

RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]
# Google SEO URL Forums:
RewriteRule ^F-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]

# Google SEO URL Threads:
RewriteRule ^T-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]

# Google SEO URL Announcements:
RewriteRule ^A-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]

# Google SEO URL Users:
RewriteRule ^U-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]

# Google SEO URL Calendars:
RewriteRule ^C-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]

# Google SEO URL Events:
RewriteRule ^E-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]

<IfModule mod_env.c>
SetEnv SEO_SUPPORT 1
</IfModule>
</IfModule>

#
# If Apache is compiled with built in mod_deflade/GZIP support
# then GZIP Javascript, CSS, HTML and XML so they're sent to
# the client faster.
#
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>

jdMorgan

1:03 pm on Dec 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please review our Apache Forum Charter [webmasterworld.com].

It contains links to useful resources, explains the purpose of this forum, and how to make best use it.

Thanks,
Jim

iElle

10:54 am on Dec 9, 2010 (gmt 0)

10+ Year Member



Yes i've understood but apache is really difficult..... and with my configuration i don't know ho to make a redirect working...

iElle

1:46 pm on Dec 9, 2010 (gmt 0)

10+ Year Member



Yahoo! Just done a code that redirects good..... now i have to know where to insert it on my htaccess

g1smd

6:47 pm on Dec 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



All of the redirects go in one block, and this block is placed before all of the rewrites.