Short way to link to http from https (and vice versa) using relative links

Short way to link to http from https (and vice versa) using relative links

When I´m in a secure part of a web-site I´m developing (entering a specific page or folder using https), the relative links to the normal pages are automatically converted to https as well.

Is there a way to tell an <a> tag to always use the http protocol instead of the https protocol (or the other way around)?

I know it´s easy using the complete link ( or, but I would like it to work with relative links (index.html, ../index.html, etc.).

HTTP version performance over firewalls


Supporting the “Expect: 100-continue” header with ASP.NET MVC
We use Apache mod_rewrite to control whether a page is served via http or https.

Data Transfer Speeds: NFS vs HTTP
Here's an example snippet from a site's root directory .htaccess file:.
Is Content-Type negotiation typical or atypical in REST apps?
# Redirect most reqests for https to http RewriteRule ^*)$1 [R=301,NC]  # Allow some URIs to be https if requested RewriteCond   %{SERVER_PORT}  ^443$ RewriteCond   %{REQUEST_URI}  !^/images/(.*)$ RewriteCond   %{REQUEST_URI}  !^/scripts/(.*)$ RewriteCond   %{REQUEST_URI}  !^/styles/(.*)$ RewriteCond   %{REQUEST_URI}  !^/store(.*)$ RewriteCond   %{REQUEST_URI}  !^/login.htm$ RewriteRule ^(.*)$1 [L,R]  # Force some URIs to be https only RewriteCond   %{SERVER_PORT}  ^80$ RewriteRule ^store(.*)$1 [L,R]  RewriteCond   %{SERVER_PORT}  ^80$ RewriteRule ^FormSanityKey.htm$1 [L,R] 
Read all about it at:.
How can I read()/write() against a python HTTPConnection?
Programmatically make HTTP requests through proxies with Python

Is it possible to save flv videos streamed via RTMP?

Issue with fetching data from a server


You can make all your internal links be protocol independent by using the following syntax:. <a href="//some/file/on/your/domain.php">link text</a>. instead of. <a href="some/file/on/your/domain.php">link text</a>. the // will make the link respect whatever protocol the page was loaded over..


Not sure if this is exactly what you were looking for, but if you're using Apache, there's a trick you can use to do this: Basically you put the following in your Apache configuration file:.
RewriteEngine on RewriteRule ^/(.*):SSL$ https://%{SERVER_NAME}/$1 [R,L] RewriteRule ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1 [R,L] 
then append :SSL to any link (in the webpage) for which you want to force HTTPS, and :NOSSL to any link for which you want to force regular HTTP..


It sounds like you want to use the BASE element.. There is no way to 'tell' an Anchor to use a specific protocol or not, at least without using the BASE element in the HEAD of that page.. Is there a reason why you want to use relative links over absolute links? This article talks about the pitfall of using relative links with HTTPS - the potential to have your site double indexed and such..


There is no way to do this with relative hyperlinks as your are using a different protocol, it would be no different than linking to a ftp location.


82 out of 100 based on 62 user ratings 562 reviews