user5837155
user5837155

Reputation:

.htaccess 301 redirect: redirect url via string

After a Joomla site upgrade I need to redirect every url which contains a string to another url. It is a Joomla site which ran SOBI2 and a few other components so the url could be:

?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=101748&lang=de

I tried the following for SOBI in the .htaccess with no success.

RewriteCond%{QUERY_STRING} .*option=com_sobi.* [NC]
RewriteRule ^(.*) http://www.mydomain.de/ [L,R=301]

Upvotes: 1

Views: 34

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

You need to add a ? at the end of the target path to remove the query strings.

RewriteCond %{QUERY_STRING} .*option=com_sobi.* [NC]
RewriteRule ^(.*) http://www.mydomain.de/? [L,R=301]

Clear your browser's cache before using this code.

Upvotes: 1

Related Questions