I'm kind of new to creating redirects and I need some help with this matter.
I'm trying to redirect a link that looks like http://marpic.pt/query_piscinas.php?modelo=Corredor%20Nata%E7%E3o
And I want to redirect to http://marpic.pt/
I tried with the following code
RewriteCond %{QUERY_STRING} modelo=Corredor%20Nata%E7%E3o
RewriteRule ^query_piscinas\.php$ /$ [L,R=301]
But it doesn't work. What am I doing wrong?
Related
I would like to make a rewrite rule for my website but I cannot seem to get the proper code in order to make this work.
The current URL of my website is looking like http://www.mohanadarafe.io/JSON/json.html
I want it to be: http://www.mohanadarafe.io/json
I have tried the following code but it does not seem to work:
RewriteEngine On
RewriteRule ^\.html$ /json [L]
Any idea how to fix this?
You have it reversed. Have it like this:
RewriteEngine On
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} /JSON/json\.html [NC]
RewriteRule ^ /json [R=301,L]
# internal forward from pretty URL to actual one
RewriteRule ^json/?$ JSON/json.html [L,NC]
Then you can have your URL as: http://www.mohanadarafe.io/json
I have a website www.mainwebsite.com with a page located at www.mainpage.com/pagename
I need to redirect a new domian name to this page. so www.newdomainname.com should redirect to www.mainpage.com/pagename
How can I do this with the htaccess?
My site is using Perch Runway too not sure if this will change anything?
Thanks
You can achieve that by using the following rules in your .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^newdomainname\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.newdomainname\.com [NC]
RewriteRule ^(.*)$ http://www.mainpage.com/pagename/$1 [L,R=301,NC]
So if either of newdomainname.com or www.newdomainname.com it will then using a 301 redirect take you to www.mainpage.com/pagename.
Make sure you clear your cache before you test this.
Hey can any one tell me how can i redirect my this page http://www.fastvpnservice.com/best-vpn-for-torrenting.html to another page http://www.fastvpnservice.com/5-best-fastest-vpn.html using .htaccess file, I would be very thankful to someone who will provide me a complete code, I just copy and paste it into my .htaccess file.
You can use:
RewriteEngine on
RewriteRule ^best-vpn-for-torrenting\.html$ 5-best-fastest-vpn.html [NC,R=301,L]
You can use the following rule to redirect the specific url to a new location :
RewriteEngine on
RewriteCond %{THE_REQUEST} /best-vpn-for-torrenting\.html [NC]
RewriteRule ^ http://www.fastvpnservice.com/5-best-fastest-vpn.html [L,R]
I want a solution to redirect http://www.myexample.com/page.php?page_id=35 to http://www.myexample.com/about-us.Please help as have been googling but all in vain.
EDITED. You can try something like this:
RewriteCond %{QUERY_STRING} ^page_id=([0-9]*)$
RewriteRule ^index.php$ /about-us? [R,L]
This will check, if index.php has parameter ?page_id,
if has, will redirected
I'm having some trouble using the right code for my .htaccess file.
What I'm trying to accomplish is this:
We have a QR code generator which generates random url'Ss like this:
http://mydomain.com?APP-V2/7091c104-32a8-4680-9c07-a75c3ee61d7a/00
I need to redirect all these url's to the homepage, http://mydomain.com.
How to I write the wildcard in my htaccess file? Basically everything after mydomain.com?APP-V2/ should be redirected.
Any help much appreciated!
Basically everything after mydomain.com?APP-V2/ should be redirected.
If you want:
http://mydomain.com/?APP-V2/7091c104-32a8-4680-9c07-a75c3ee61d7a/00
to be redirected to:
http://mydomain.com/
Then you just get rid of the query string (e.g. ?APP-V2/7091c104-32a8-4680-9c07-a75c3ee61d7a/00):
RewriteEngine On
RewriteCond %{QUERY_STRING} ^APP-V2/
RewriteRule ^$ /? [L]
But if you want everything after the ?APP-V2/, you need this:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^APP-V2/(.*)$
RewriteRule ^$ /%1? [L]