Rewrite rule to an other domain keeping rest of url - regex

This is what I need to do:
website EXAMPLE with url
/?VVWM=$59095-K9T-50U00-VX0U**|jDDQvcZbTESbGqI2AJ8Iww|dIWecCGiGUive6I2AJ8Iww||||1|0$&utm_source=followup-offerte&utm_medium=email&utm_campaign=VVWM
has to redirect to:
http://www.sluitsnel.nl/goedkope-scooterverzekering/?VVWM=$59095-K9T-50U00-VX0U**|jDDQvcZbTESbGqI2AJ8Iww|dIWecCGiGUive6I2AJ8Iww||||1|0$&utm_source=followup-offerte&utm_medium=email&utm_campaign=VVWM
So the indication for this redirection is:
http://www.goedkope-scooterverzekeringen.nl/?VVWM=$59095-K9T-50U00-VX0U
Thanks in advcance!
Greetings,
Ivar

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?goedkope-scooterverzekeringen\.nl$ [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+\?(VVWM=$59095-K9T-50U00-VX0U[^\s]*) [NC]
RewriteRule ^ http://www.sluitsnel.nl/goedkope-scooterverzekering/?%1 [R=301,L,NE]

Related

GET request htaccess redirection

I need to redirect url from
website.com/search.php?city=india&keyword=laptop
to
website.com/search/india/laptop
How can i do this with htaccess
Present code in my htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-z0-9_-]+)/([a-z0-9_-]+)(/)?$ search.php?city=$1&keyword=$2
You can use this rule in your root .htaccess file:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{THE_REQUEST} \s/+search\.php\?city=([^&]+)&keyword=([^\s&]+) [NC]
RewriteRule ^ /search/%1/%2? [R=301,L,NE]
RewriteRule ^search/([\w-]+)/([\w-]+)/?$ /search.php?city=$1&keyword=$2 [L,QSA]

htaccess redirect file request of one to another file

I need modificate file request http://subdomain.site.com/file.txt -> http://site.com/file-subdomain.txt
Please help with htaccess code. Thanks!
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(subdomain)\.(site\.com)$ [NC]
RewriteRule ^file\.txt$ http://%2/file-%1.txt [L,R=301,NC]
EDIT:
RewriteCond %{HTTP_HOST} ^(subdomain)\.(site\.com)$ [NC]
RewriteRule ^file\.txt$ /file-%1.txt [L,NC]

mod rewrite for pretty urls and also hide index.php

How can i mod-rewrite to obtaining a pretty url like below
example.com
contains a form to get a text value and pass it another file for processing that file is in directory as web but i need to change that as pretty urls
example.com/web/index.php?url=mydomain.com
to
example.com/web/mydomain.com
example.com/web/newdomain.com
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+web/index\.php\?url=([^\s&]+) [NC]
RewriteRule ^ /web/%1? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^web/(.+?)/?$ /web/index.php?url=$1 [L,QSA]

redirect from https to http under certain conditions with .htaccess

I'm scratching my head on this one. I need to set up a rule so when someone goes to an address on my site with /members/ in the url it will automatically switch back to http from https.
so kinda like
RewriteCond %{REQUEST_URI} ^/members/
RewriteRule ^(.*)$ http://www.domain-name.co.uk/$1
well I'm not so great with this type of problem so some help would be very much appreciated.
edit- current .htaccess
#RewriteCond %{HTTPS} on
#RewriteCond %{REQUEST_URI} !(acatalog)
#RewriteRule ^(.*)$ http:// %{SERVER_NAME}%{REQUEST_URI} [R=301]
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on
RewriteRule ^(members/.*)$ http://%{HTTP_HOST}/$1 [L,R,NC]
This should do the trick:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^members/(.*) http://www.domain-name.co.uk/members/$1
RewriteCond %{HTTPS} on checks whether https is used. Only if this is true, the RewriteRule will be active.

htaccess how to redirect subdirectory to external URL

I tried:
//301 Redirect Old File
Redirect 301 www.mydomain.com/subdirectory http://newurl.com
but that lands me at newurl.com/subdirectory, which doesn't exist.
Enable mod_rewrite and .htaccess then add this code in your .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC]
RewriteRule ^subdirectory/?$ http://newurl.com [L,R=301,NC]