i need to redirct the following url:
https://www.domain.de/?topic=bla&ID=11111&serie=2222
to
https://www.domain.de
I tried this, but it doesn't work:
RewriteRule ^?topic=(.*)$ https://www.domain.de [R=301,L]
Got it...
RewriteCond %{QUERY_STRING} topic [NC]
RewriteRule .* https://www.domain.de? [R=301,L]
Related
I need to redirect all the URL not www with index.php in the path to the same in the www version.
I wrote this:
RewriteCond %{HTTP_HOST} ^
RewriteCond %{REQUEST_URI} ^/index.php/it/(.*)$ [NC]
RewriteRule ^(.*)$ https://www.DOMAIN.it/$1/? [L,R=301]
but the result is:
https://www.DOMAIN.it/index.php/it/SOMETHING/
I need:
https://www.DOMAIN.it/SOMETHING/
what's wrong?
Thanks all
You can use this :
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} ^/index.php/it/(.*)$ [NC]
RewriteRule ^index\.php/(.*)$ https://www.DOMAIN.it/$1/? [L,R=301]
The reason why index.php is appending to your redirected URL is because the regex (.*) matches the full URL path and you just need to match a specific part of the URL or everything that comes bafter /index.php .
Solved, I removed the request URL:
RewriteCond %{HTTP_HOST} !^(.*)\.domain\.it$ [NC]
RewriteRule ^index.php/it/(.*)$ https://www.domain.it/$1/ [R=301,L]
thanks
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 ?
I need to add redirect from page http://www.mysite.ru/news/?PAGEN_1=1 to http://www.mysite.ru/news/, so I added in .htaccess file code below
RewriteCond %{QUERY_STRING} ^PAGEN_1=1 [NC]
RewriteRule ^news/$ http://www.mysite.ru/news/ [R=301,L]
but I get error "ERR_TOO_MANY_REDIRECTS". What's wrong and how to fix it?
This code works
RewriteCond %{QUERY_STRING} ^PAGEN_1=1 [NC]
RewriteRule ^news/$ http://www.mysite.ru/news/$ [R=301,L]
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.
I've tried using RewriteCond and RewriteRule to redirect a complex URL to a new page but without success.
The original URL:
index.php?option=com_k2&view=item&id=127&Itemid=353
or http://www.example.com/index.php?option=com_k2&view=item&id=127&Itemid=353
Have tried:
RewriteRule ^index.php?option=com_k2&view=item&id=127& Itemid=353$ http://www.example.com/somepage [R=301,L]
Also:
RewriteCond %{QUERY_STRING} index.php?option=com_k2&view=item&id=127&Itemid=353
RewriteRule http://www.example.com/somepage [R=301]
And:
RewriteCond %{QUERY_STRING} ^id=127&Itemid=353$
RewriteRule ^$ http://www.example.com/somepage [R=301]
What am I missing?
Try:
RewriteCond %{QUERY_STRING} (^|&)id=127&Itemid=353(&|$)
RewriteRule ^(?:index\.php|)$ http://www.example.com/somepage [L,R=301]