简体   繁体   中英

.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]

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM