How could I redirect the following URL from my site to an other website (URL wth parameters too) using the .htaccess?
Example:
Redirect
http://mysite.com.br/page/?r=17dzhZ3JG5jfKMd45BowS1Pr1cH9FW8zzK
to
http://anothersite.com.br/?r=1vEe4mDd94JQLCCTnX3Cdzy2KFfH6eKbS
In the htaccess file on mysite.com.br's document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^r=17dzhZ3JG5jfKMd45BowS1Pr1cH9FW8zzK$
RewriteRule ^page/?$ http://anothersite.com.br/?r=1vEe4mDd94JQLCCTnX3Cdzy2KFfH6eKbS [L,R]
Related
I want to redirect example.com/recipes/signup?code=OLD277 to example.com/recipes-user/register How can I achieve it via htacces?
I tried the below code in .htaccess but its not working!
Redirect /recipes/signup?code=OLD277 http://example.com/recipes-user/register
You may use this rule as your topmost rule in site root .htaccess:
RewriteEngine On
RewriteCond %{THE_REQUEST} /recipes/signup\?code=OLD277\s [NC]
RewriteRule . /recipes-user/register? [R=301,L,NE]
I want to redirect this link:
/content/catagorie.php?item=Notariaat
To this link:
http://www.meddo.nl/vacatures/notariaat/
I used this:
Redirect /content/catagorie.php?item=Notariaat http://www.meddo.nl/vacatures/notariaat/
But it didn't work.
Thx
use this 301 redirect
Redirect 301 http://example.com/content/catagorie.php?item=Notariaat http://www.meddo.nl/vacatures/notariaat/
You can use these 2 rules in root .htaccess file:
RewriteEngine On
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /content/catagorie\.php\?item=([^\s&]+) [NC]
RewriteRule ^ /vacatures/%1? [R=302,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^vacatures/([^/.]+)/?$ /content/catagorie.php\?item=$1 [L,QSA,NC]
How to redirect this
https://www.example.com/watch?v=ilTNJoSgeF8
to this
http://www.example.com/#/watch/ilTNJoSgeF8
so it just need to change this /watch?v= into this /#/watch/
Using mod_rewrite, you can do something like this in the htaccess file in your document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^v=([^&]+)
RewriteRule ^watch$ /#/watch/%1? [L,NE,R]
Pl advise, we made a mistake in creating lot of duplicate content for site in a section usedtoys
How to use htaccess to remove :- 'brand' & 'location' from url & redirect to correct url
For eg. correct url
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3
Incorrect URL
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3&brand=1
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3&brand=1&location=delhi
or
Correct URL
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3&limitstart=45
Incorrect URL
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3&brand=1&limitstart=45
http://www.abc.com/index.php?option=com_toys&view=category&Itemid=3&brand=1&location=delhi&limitstart=45
How to create a 301 redirect in htaccess so that any url having com_toys - with brand and/or location can be stripped and redirected to there correct url.
Try:
RewriteEngine On
RewriteCond %{QUERY_STRING} (^|&)option=com_toys(&|$)
RewriteCond %{QUERY_STRING} ^(.*)&brand=([^&]+)(.*)$
RewriteRule ^index\.php$ /index.php?%1%3 [L,R=301]
RewriteCond %{QUERY_STRING} (^|&)option=com_toys(&|$)
RewriteCond %{QUERY_STRING} ^(.*)&location=([^&]+)(.*)$
RewriteRule ^index\.php$ /index.php?%1%3 [L,R=301]
in the htaccess file in your document root, preferably above any rules that you already have.
I have this url
www.example.com/nothing_here?registration=disabled
and I want to redirect it to
www.example.com/errors/418.php
I cannot get rid of the nothing_here part of the url. How to do this?
Thanks
In the htaccess file in your document root, add:
RedirectMatch 301 ^/nothing_here$ /errors/418.php?
or using mod_rewrite:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^registration=disabled$ [NC]
RewriteRule ^nothing_here$ /errors/418.php [L,R=301]