nbar
nbar

Reputation: 6158

Why is my RewriteRule not working? Regex matches

URL should go

from: http://myurl.com/anything/?_escaped_fragment_=/article/1234
  to: http://myurl.com/rubriken/detail/articleuid/1234/

My RewriteRule looks like:

RewriteRule ^.*\?_escaped_fragment_=\/article/(.*)$ /rubriken/detail/articleuid/$1/ [R=301,L]

I tested the regex on http://regex101.com/ and it matches. But it does not work in my .htaccess and also not on http://htaccess.madewithlove.be/ . Where is my mistake?

Upvotes: 0

Views: 69

Answers (1)

Croises
Croises

Reputation: 18671

Because ?_escaped_fragment_=/article/1234 is not used in the RewriteRule

Use:

RewriteCond %{QUERY_STRING} _escaped_fragment_=/article/(.*)$
RewriteRule ^ /rubriken/detail/articleuid/%1/? [R=302,L]

Change [R=302,L] for [R=301,L] when test work well.

Upvotes: 2

Related Questions