WordPress.org

Ready to get started?Download WordPress

Forums

Domain migration and redirects (3 posts)

  1. MattAtNatwell
    Member
    Posted 1 year ago #

    I have a bit of a problem with redirects. We're in the process of migrating domains from http://www.example-domain.com to http://www.exampledomain.com (we're losing the dash.) I'm trying to do wildcard redirects, wherein an inbound link of
    http://www.example-domain.com/wp/archives/2013/05/some_article_name.htm

    will redirect to http://www.exampledomain.com/wp/archives/2013/05/some_article_name.htm

    for almost all of the site, this was a single line on the .htaccess file in the root of the domain, but wordpress has not been playing nice. Right now,
    http://www.example-domain.com/wp
    redirects to
    http://www.exampledomain.com/

    AND

    http://www.example-domain.com/wp/archives/2013/05/some_article_name.htm

    doesn't redirect at all.

    I have sudo and root access on the server, but I'm not sure what to do with them. I can't shut down http://www.example-domain.com/wp/x because we have a lot of marketing e-mails that point back to that domain.

    Any insight would be greatly appreciated.

    I'm omitting the site name because I'm sincere about this problem- I don't want anyone thinking I'm just out to get some clicks. If you want to see this first-hand, let me know and I'll give you valid links.

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    Are you trying to redirect .htm files to WordPress? If not, and that was just an example to confuse us :-)- and all site links are the same (just different domains now, you want rewrite rules at the old site at top of .htaccess:

    RewriteEngine On
    RewriteRule ^(.*)$ http://newdomain.com/ [L,R=301]

    If you have specific locations on the old server that you do not want to redirect, you will have to specialize these rules accordingly.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^folder-name-here
    RewriteRule ^(.*)$ http://newdomain.com/ [L,R=301]

    As for the WordPress rewrite rules, deactivate any caching or other plugins that would want to modify .htaccess (turn back on after site is resolving)

    Delete or rename .htaccess. Login to admin and save your permalink settings...if you have WP setup (edit:properly) it should create a .htaccess file right place something like (let wp do it):

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wp/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wp/index.php [L]
    </IfModule>

    report back please.

  3. MattAtNatwell
    Member
    Posted 1 year ago #

    What I'm trying to do is switch out a domain on a single vhost, though it might be easier to create a new one and use that for the redirect. Here's my current .htaccess (within my wordpress directory)

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wp/index.php [L]
    </IfModule>

Topic Closed

This topic has been closed to new replies.

About this Topic