I am trying to redirect to some magento urls to http
My current url are
https://www.amitbera.com/shop.html
https://www.amitbera.com/shop/abc.html
https://www.amitbera.com/shop/abc.html
https://www.amitbera.com/shop/jde.html
https://www.amitbera.com/shop/fg.html
https://www.amitbera.com/shop/fg/gyt.html
https://www.amitbera.com/shop/fg/gyt/test.html
I want to redirect all shop url to http url .Just like mysql function like function shop% redirect to 301 https to http
http://www.amitbera.com/shop.html
http://www.amitbera.com/shop/abc.html
http://www.amitbera.com/shop/abc.html
http://www.amitbera.com/shop/jde.html
http://www.amitbera.com/shop/fg.html
http://www.amitbera.com/shop/fg/gyt.html
http://www.amitbera.com/shop/fg/gyt/test.html
You can change this in the Magento Admin panel.
System -> Configuration -> Web -> Secure
Use Secure URL's in Frontend: Yes
Set that option to no, and it should redirect to http:// automatically.
This code for solved this problem
Options +FollowSymLinks
RewriteEngine on
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(shop|blog|stockists|inthepress|contacts|review|home) http://www.example.com%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HTTP_HOST} [L,R]
Thanks!!!!!!!!
Related
I need to redirect all pages with https:
https://shop.test.com/
https://shop.test.com/several_parameters
To http://www.test.com.
But we should not redirect a page like
https://shop.test.com/checkout/onepage
It sounds like there are certain URLs that you want to allow as https on shop.test.com. For each of these rules, add a RewriteCond like the following (replacing {URL HERE} with the URL you want to allow):
RewriteCond %{REQUEST_URI} !^{URL HERE}
Here is the entirety of the solution to deal with the cases that you specified above:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^shop.test.com$
RewriteCond %{REQUEST_URI} !^/checkout/onepage
RewriteRule .* http://www.test.com/$1 [L,R=301]
Caution!
It's worth noting that if you don't whitelist a URL that is listed as secure by Magento that you will create an infinite redirect loop. To help make sure that you whitelist every possible secure URL, you can grep the codebase for <secure_url> and whitelist each of those endpoints.
I hope you can help with this htaccess issue please? I basically have the htaccess rules working apart from in one scenario. This is the case where a user visits the site on a non HTTPS and non WWW links.
Re-Directs
User visits on http/non-WWW URL
User is redirected initially to the http/WWW URL
User is then redirected to https://www.website
You can see the behaviour here:
http://childrens-curtains.co.uk
All other scenarios work fine.
I want to try to remove the 2nd redirect from the sequence so it behaves like this:
User visits on http and is immediately redirected to the https/www version without the 2nd step (if that makes sense?)
The current scenario causes multiple re-directs, which I understand is a bad approach from an SEO perspective.
This is my htaccess redirect rule:
RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [L,R=301]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context
You can try this code keepin into .htaccess file.
To add www add following code.
RewriteCond %{HTTP_HOST} ^**domainname**\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domainname\.com$
RewriteRule ^index\.html$ "http\:\/\/www\.domainname\.com\/" [R=301,L]
To add http add following code.
RewriteCond %{HTTP_HOST} ^domainname.com [NC]
RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]
Which will add both http as well as www to URL.
Thanks.
A client wants to redirect a domain (oldsite.com) to a new domain & subdirectory (newsite.com/subdirectory). I have this code setup and it works for for oldsite.com, but when I test oldsite.com/subdomain I get a 404 at newsite.com.
Redirect 301 / http://www.newsite.com/subdomain/
Is there a way to handle any subdomain requests at oldsite.com so they all redirect to newsite.com/subdirectory? Maybe a wildcard?
You can use this in the .htaccess of the web root of the old site:
RewriteEngine On
RewriteRule ^subdomain/(.*) http://newsite.com/subdirectory/$1 [B,NE,R,L]
Try this:
RewriteCond %{HTTP_HOST} oldsite\.com [NC]
RewriteRule (.*) http://newsite.com/subdirectory/$1 [QSA,L]
I want to redirect my contact page to https trough .htaccess with moderewrite.
this is the url of my contact page:
http://mywebsite.com/index.php?route=information/contact (this is opencart website).
Which will be the correct rewrite rule to redirect this on to https ?
Try:
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(/index.php?route=information/contact) https://mywebsite.com$1 [L,R=301]
(OP asked how to do it with “mod_rewrite”)
Just a simple "this for that" redirect:
Redirect 301 http://mywebsite.com/index.php?route=information/contact https://mywebsite.com/index.php?route=information/contact
I have a site which is using the www (www.domain.com and not domain.com).
But the SSL certificate is valid only for domain.com (https://domain.com). So if I call https://www.domain.com, there comes an error.
My question is, if I can make a silent redirect from https://www.domain.com to https://domain.com via htaccess?
Thanks.
Like LazyOne said:
Yes, it is NOT possible to do it silently .. as SSL has to be
established BEFORE HTTP part can kick in (in other words, before
mod_rewrite can execute rewrite/redirect rules).
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ https://domain.com/$1 [L,R=301]
Taken from http://davidwalsh.name/no-www-using-htaccess-file