user1563825
user1563825

Reputation:

301 redirect with RewriteRules

I have a problem concerning RewriteRules. I'd like to move one page permanently, so I want to use a 301 redirect. I tried this:

RewriteRule ^page1/([A-Z].*)$ http://www.abs.nl/page1/vraag-$1 [R=301]

However this does not work. Can someone please tell me how I could fix this? I already tried for hours to find an answer.

Should I also use a %{HTTP_HOST} condition? I see this a lot but I don't know how it works.

Upvotes: 0

Views: 62

Answers (1)

bradym
bradym

Reputation: 4961

A couple things:

  1. Make sure that you have RewriteEngine On before your rewrite rule.
  2. Your current regex is looking for a capital letter followed by any character, is this what you want?

Try this:

RewriteEngine On
RewriteRule ^page/(.*)$ http://www.abs.nl/page1/vraag-$1 [R=301,L]

That redirect will match on any string of characters following page/ in a URL.

Upvotes: 1

Related Questions