Redirect code with "?" does not working - .htaccess

I need to redirect this page:
http://orbit-cs.com/Orbit/SendFile.asp?DBID=1&LNGID=1&GID=882
To this:
http://orbit-cs.com/news/
.htaccess:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^DBID=1&LNGID=1&GID=882$
RewriteRule ^orbit-cs.com/Orbit/SendFile.asp?$ orbit-cs.com/news [L,R=301]
Any idea why it's not working?

You don't match domain name in RewriteRule. That is used for matching REQUEST_URI only. Use this rule:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^DBID=1&LNGID=1&GID=882$ [NC]
RewriteRule ^/?Orbit/SendFile\.asp$ orbit-cs.com/news? [NC,L,R=301]

Related

How redirect query search result from domain which contains a folder?

I have this code in my .htacces file:
RewriteCond %{QUERY_STRING} \\?s=([^&]+) [NC]
RewriteRule ^$ job\?search_keywords=%1 [NC,R,L]
And it works well for: example.com/?s=blabla
Now I would like to add that if the url contains /en/:
https://example.com/en/?s=blabla
change for https://example.com/en/work/?search_keywords=blabla
Somone could help me with it? Because my trying gives me ERROR 500.
You just need another rule to handle new URI pattern:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^s=([^&]+) [NC]
RewriteRule ^$ /job?search_keywords=%1 [R=301,L]
RewriteCond %{QUERY_STRING} ^s=([^&]+) [NC]
RewriteRule ^en/?$ /en/work/?search_keywords=%1 [R=301,L]
Note that \\? in your RewriteCond is redundant as QUERY_STRING variable doesn't contain ?

.htaccess redirect with question mark

I'm trying this to redirect via .htaccess a this URL
http://www.deguate.com/foros/showthread.php?874-Soy-de-Guatemala-y-quiero-dar-a-mi-bebe-en-adopcion
to this one:
https://www.deguate.com/artman/publish/mujer-actualidad/Soy-de-Guatemala-quiero-dar-mi-bebe-adopcion.shtml
I've tried many options but nothing seems to work, like:
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^foros\/showthread\.php\?874\-Soy\-de\-Guatemala\-y\-quiero\-dar\-a\-mi\-bebe\-en\-adopcion$ "https\:\/\/www\.deguate\.com\/artman\/publish\/mujer\-actualidad\/Soy\-de\-Guatemala\-quiero\-dar\-mi\-bebe\-adopcion\.shtml" [R=301,L]
You can use the following rule:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(874-Soy-de-Guatemala-y-quiero-dar-a-mi-bebe-en-adopcion)$
RewriteRule ^foros/showthread\.php$ https://www.deguate.com/artman/publish/mujer-actualidad/%1? [L,R]

RewriteCond %{QUERY_STRING} ^page=3$.How to work only page=3? I do not want to redirect page=33

I want to redirect only /?page=3 to /.
/?page=33 is not redirect.
The following code also redirects /?page=33
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=3$
RewriteRule / [R=301,L]
You can use:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^page=3$
RewriteRule ^ /? [R=301,L]
With ? to prevent the automatic addition of ?page=3
Try it like this, clear your browser cache first after that if it works change R=302 to 301
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=3
RewriteRule ^ / [R=302,L]

.htacces redirect with special signs

Need help ;)
How to redirect this link?
mydomain.com/selbständige?catid=141&id=141:kredit-für-selbstständige-ohne-schufa
Tested with:
RewriteCond %{QUERY_STRING} ^(.+&)?selbständige?catid=141(&.+)?$
RewriteRule ^/$ http://test.com? [R=301,L]
RewriteCond %{QUERY_STRING} ^(.+&)selbst%E4ndige?catid=141(&.+)?$
RewriteRule ^/$ http://test.com? [R=301,L]
redirect 301 "/selbständige?catid=141&id=141:kredit-für-selbstständige-ohne-schufa" http://test.com
...and so on.
No normal workflow works.
Try :
RewriteEngine on
RewriteCond %{THE_REQUEST} /selbst.+ndige\?catid=141&id=141:kredit-f.+r-selbstst.+ndige-ohne-schufa [NC]
RewriteRule ^ http://test.com? [L,R]
I used .+ to match against special chars in the uri.

RewriteRule at htaccess wrong redirect

ive this rules at htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.com [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^warcraft$ www.site.com/forumdisplay.php?f=480 [R=301,NE,NC,L]
issue happend when redirect warcraft its redirect to
http://www.site.com/home/site/public_html/www.site.com/forumdisplay.php?f=480
any tip ?
I suppose you want to redirect it to http://www.site.com/forumdisplay.php?f=480
If so put it in your .htaccess file:
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^warcraft$ http://www.site.com/forumdisplay.php?f=480 [R=301,NE,NC,L]
You must provide the full URL including protocol in your rule, in this case http://www.site.com/.....

Resources