Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12488

Reply To: htaccess Redirect Code – Where Do I Add Redirect htaccess Code

$
0
0

Hi there,

I’ve read and re-read about redirection for an old page to a new page, thought I’d ‘got it’, but my code doesn’t seem to work… Please could you check my code to see if it’s correct for the situation?

Situation:

  • developing a new site, but with all pages imported from the old site into the new site and re-using as many of these as possible.
  • Old site was a root install
  • New site is in its own folder BUT I’ve changed the NEW site’s url to point to the root in the general settings, as in GWIOD guidelines.
  • So the new site’s url is the same as the old site’s url – and updated all urls with Velvet Blues url updater and all working fine (phew!).

So I have some old pages in my new site that need to be redirected: to other pages, or to my home page, or to another totally new site I have.

So for the 3 redirects egs. I have:

  • page http://www.my-site.com/competitions/ —>  to http://www.my-site.com/index.php
  • page http://www.my-site.com/copyright-info/ —>  to http://www.my-site.com/terms-and-conditions
  • page http://www.my-site.com/hzp-group/ —>  to http://www.my-other-site.com/index.php

and the code I have put in the Bottom custom code box in the .htaccess for the 3 egs. above is this:

#301 Redirect Old Files JP edit
Redirectmatch 301 ^/competitions$ http://www.my-site.com/$1
Redirectmatch 301 ^/copyright-info$ http://www.my-site.com/terms-and-conditions$1
Redirectmatch 301 ^/hzp-group$ http://www.my-other-site.com/$1

Any ideas why it’s not working?

Additional info…

  • Old site is still my current site
  • new site was initially developed in a sub-folder of my old site, with WP url and site url the same ie: www.mysite.com/newsite
  • I’ve since migrated the new site to a new server, keeping it the same as above, but obviously now not with the old site in the root.
  • I’m now working on the new site, on the new server, but the DNS is still pointing to my old site.
  • So I’ve edited my computer’s host file to see my new site on the new server, and it’s this site I’m working on.
  • And now I’ve changed the new site’s (on the new server) site url to the root, so WP url is the same = www.mysite.com/newsite and site url is now = www.mysite.com

Hope this helps fill in any gaps?
many thanks, j


Viewing all articles
Browse latest Browse all 12488

Trending Articles