Jump to content

Redirecting certain links to legacy site after installing IC


Meddysong

Recommended Posts

I've launched a new-look site using Invision Community. In doing that, hundreds of old links (in bookmarks, on printed media) have ceased to exist. I've moved the old version of my site to a subdomain and would like to redirect certain links, so that somebody searching for content still lands on it.

My site is esperanto.org.uk. I've moved the old one to legacy.esperanto.org.uk.

I've been playing around with htaccess but changes aren't working in all situations. For example, let's consider when someone goes to esperanto.org.uk/fpc. That address no longer exists on the current site, so I'd like the request to go to legacy.esperanto.org.uk:

This rule causes the redirect to work:

RewriteRule fpc/$ https://legacy.esperanto.org.uk%{REQUEST_URI}  [L,NC,R]

As does this rule:

RewriteRule ^(fpc/.*)$ https://legacy.esperanto.org.uk/$1 [R=302,L,NC]

I was hoping that they would also redirect anything following /fpc but they're not. If someone enters https://esperanto.org.uk/fpc/fpc01/fpc01-a4.pdf with either of those rules, it goes to that address and 404s without redirecting.

I'm afraid I find mod_rewrite quite tricky. My question is straightforward but I just can't find an answer or a way of formulating. I want a statement which means "if the request contains /fpc/" redirect to the same request but with the subdomain "legacy": 

  • esperanto.org.uk/fpc/ > legacy.esperanto.org.uk/fpc/
  • esperanto.org.uk/fpc/lesson-1 > legacy.esperanto.org.uk/fpc/lesson-1
  • esperanto.org.uk/fpc/lesson-1/questions.html > legacy.esperanto.org.uk/fpc/lesson-1/questions.html

I would've thought that this is quite obvious but I just can't find an answer. Does anybody else know?

Link to comment
Share on other sites

1 hour ago, opentype said:

Seems to work fine now. 

What happens if you paste it in your browser rather than click a link? I'm getting the redirect only if I click it. If I type or paste it, I'm getting a 404.

That's true too for other addresses except for esperanto.org.uk/fpc. If I type or paste that one, it correctly redirects.

It seems to be that if anything follows /fpc/ then only clicking a link will work.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...