skip to Main Content

I am using .htaccess to redirect pages from an old website to a new site. The URL structure has changed completely, but thanks to a SEO person I have a complete list of URLs I have to redirect and take care of.

My .htaccess looks like the following:

Options +FollowSymlinks
RewriteEngine On
Redirect 301 /some-guy http://www.new.domain/kontakt/
Redirect 301 /some-other-guy http://www.new.domain/kontakt/
...
Redirect 301 /de/some-page http://www.new.domain/some/subpage/
Redirect 301 /de/another/page http://www.new.domain/nice-page/

Of course the URLs can be even longer and contain query strings and stuff like that. The new website has a different URL structure and does not need query strings and nothing.

Now, while the first two redirects work perfectly, every redirect which contains a subfolder fails to redirect to the target location. The last URL for example redirects to

http://www.new.domain/de/another/page

What am I missing here?

2

Answers


  1. Chosen as BEST ANSWER

    I got it working now with little modifications to Anup Saunds code (and therefore using mod_rewrite).

    I used the following structure which seems to work fine with all links I have and sets the status code for search engines.

    Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^what/ever/your/path-is(.*)$ http://www.new.domain/oh-what/a-nice-path/ [R=301,nc]

  2. Try

    Redirect 301 ^de/another/page http://www.new.domain/nice-page [L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search