speicif HTTP url to HTTPS url (only one url) - mod-rewrite

I was searching on web for like 4 hours and tryeda almoast everything, but nothing worked.
All i want to do is force redirecting for norma url to https url, using .htaccess, example:
I want that when person visit:
- http://www.mydomain.com/index.php?option=com_dms&task=checkout&Itemid=816
See:
- https://www.mydomain.com/index.php?option=com_dms&task=checkout&Itemid=816
that's pretty much all, I hope this is simple enough.
Thanks for answers in advance!

To do it only for your URL, this should work :
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^http://www\.mydomain\.com/index\.php?option=com_dms&task=checkout&Itemid=816$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Replace the URL by .* for all traffic.

Related

Issues with RewriteRule on Generic Anchor Redirect

I want to redirect any request to the root of my site to an anchor on the index. So
https://example.com/foo
Gets sent to
https://example.com/#foo
I've written this .htaccess file (it also redirects http requests to https, that part works, but is included for completeness)
RewriteEngine On
RewriteRule ^/(.*) /#$1 [NE,R=302]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Based on the discussion in this thread: mod_rewrite with anchor link this should work, but it's not matching for some reason. I tried out the rule given in that thread using this tool: http://htaccess.madewithlove.be/ and it doesn't seem to work there either.
I've tried clearing my cache and accessing in incognito mode, to no avail. Any help?

Proper Way to Redirect to HTTPS

According to the tool below, I'm not redirecting our site to HTTPS properly.
https://www.linksspy.com/seo-tools/free-seo-ssl-scan/barefootmosquito-com
Does anyone know the proper way to 301 redirect all versions of a homepage to https://www.example.com? These are the other versions of a homepage I'm referring to:
http://example.com
http://www.example.com
https://example.com?
I found this question asked a few years ago, but there was a lot of back and forth about what the best way to do this was, and there didn't seem to be a definite answer among the group.
Any help would be much appreciated. Thank you in advance!
To redirect your http non-secure traffic over the https secure page, you need to add below code into your .htaccess file. Once you update your .htaccess file then http, www and non-www all requests use the 301 permanent redirection tool and redirect on https secure protocol.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
You should use below code for 301 redirection, it will definitely work for you.
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) https://www.domainname.com%{REQUEST_URI} [L,R=301]

Htacces rewrite for magento http to https for one domain of multishop

We are looking for a solution for our htacces rewrite and have been looking all over the internet and could not find the solution. We have a multishop with 10 shops and are now going over at https and first want to test one shop and then do the others. We have set everything up correctly, but do not get the 301 redirect to work.
We have tried the following code:
RewriteCond %{HTTP_HOST} ^domain\.be$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.be/$1 [R=301,L]
But with this code all pages of the other webshops will also be redirected to this domain. Can someone help us setting it up so we can start transfer to https?
You need to remove the OR.
RewriteCond %{HTTP_HOST} ^domain\.be$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.be/$1 [R=301,L]
If you have split each of your domains to have independent vhosts (likely) and therefore utilize a separate block for SSL and HTTP, you should think about using a Redirect 301 in the HTTP section of the vhost to reduce complexity.

rewrite timthumb to actual url

I'm stuck.
I don't want to use timthumb anymore and removed it. I get some requests from Facebook that I want to redirect/rewrite with .htaccess, but everything I tried didn't work out.
This is the request url
example.com/wp-content/themes/Example/timthumb.php?src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2Fimage_level1.jpg&h=350&w=960&zc=1
and I want them to go straight to
example.com/wp-content/uploads/image_level1.jpg
Any help is highly appreciated.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wp-content/themes/Example/timthumb.php?src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2F([a-zA-Z0-9]+).jpg&h=350&w=960&zc=1$ wp-content/uploads/$1.jpg
This should do the trick
I have ended up using this one
RewriteCond %{QUERY_STRING} ^src=http%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2F(.*)&h=350&w=960&zc=1$ [NC]
RewriteRule ^(.*)$ http://example.com/wp-content/uploads/%1? [NC, L]

force https to a certain url

I know this issue has been addressed in many ways, but couldn't find any similar to this one I have now. The thing is that I have a code to force https to a certain or a particular url, but it seems that the (s) letter can be removed by hand so the url goes with http instead!! I mean I want the https to be force again in case the url is changed from https to http.
I hope it is a clear explanation.
RewriteCond %{SERVER_PORT} 443
RewriteCond %{REQUEST_URI} main
RewriteRule ^(.*)$ https://www.domain.com/folder1/folder2/login$1 [R,L]
does this code redirect again in case https is changed??
Thanks
Update #1
I got the meaning of what I want to point out to. It is called "blocked crawling of https"
Do this:
RewriteCond %{REQUEST_URI} main
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.domain.com/folder1/folder2/login$1 [R,L]

Resources