ASP.NET 3.5, VB.NET
We have a website, e.g. hosted with an external web host.
We want to get a SSL certificate so that the site can be https. Our webhost said they will "install" the certificate on the server for us.
Once they have done that, how do we make it so when someone types www.oursite.com into their browser, it automatically goes to https://www.oursite.com and not http://www.oursite.com?
Also, we have many hardcoded links in the site that point to various other pages on the site but use the full URL, e.g. http://www.oursite.com/somefolder/somepage.aspx
How do we make it so those links end up going to the https version of the page?
Create a file and rename it ".htaccess" to ur public_html.
it will add auto redirect links to "https://" protocol.
write ur own website adress..
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourwebsite.com/$1 [R,L]
For automatically redirect http to https you can ask your webhost.Normaly they can do. Check this link for others methods
For hardcoded links: Replace 'http' or 'https' with '//', for example instead of http://yoursite.com/script.js use //yoursite.com/script.js .However I recommend to use relative path, if it's possible.
For Web control or server controls you can use Tilda "~" or Control.ResolveUrl. for example :
<asp:HyperLink NavigateUrl="~/views/view.aspx" runat="server" />
<a href="~/views/view.aspx" runat="server" >
Related
Hi i see all thread here but codes not work for my problem.
I have a custom page landing.php (in root of wp site) and this is landing page with one link only (static page)
I want to site.com/landing.php redirect just to site.com/landing/ , but landing.php redirect to /landing
I try with this code:
RewriteRule ^landing/?$ landing.php [L]
But in this case i can open /landing/ and /landing.php, i want landing.php redirect to /landing/
Thanks
It is a bit unclear what you actually want...
But this is the answer to what you specifically asked in the comment to your question:
RewriteEngine on
RewriteRule ^/?landing\.php$ /landing/ [R=301]
That rule will work likewise in the real http server's host configuration and in a dynamic configuration file (".htaccess" style files).
A remark however: you should always prefer to place such rules in the http servers host configuration instead of using dynamic configuration files (".htaccess"). Those dynamic configuration files add complexity, are often a cause of unexpected behavior, hard to debug and they really slow down the http server. They are only provided as a last option for situations where you do not have access to the real http servers host configuration (read: really cheap service providers) or for applications insisting on writing their own rules (which is an obvious security nightmare).
However considering what is typically done for simple web projects I guess this is what you are looking for:
RewriteEngine on
RewriteRule ^/?landing\.php$ /landing/ [R=301]
RewriteRule ^/?landing/?$ /landing.php [END]
In case you experience an internal server error using above rules (http status 500) then chances are that you operate a very old version of the apache http server. You should try to upgrade, in case that is not possible have a try using the L flag instead of the END flag. It might work just fine depending on your setup.
I'm getting them on my links in my head.
GET https://fr.s.us/js/jquery-ui.css net::ERR_INSECURE_RESPONSE
GET https://fr.s.us/js/jquery-1.9.1.min.js net::ERR_INSECURE_RESPONSE
GET https://fr.s.us/js/jquery-ui.js net::ERR_INSECURE_RESPONSE
Someone please enlighten me on these jquery console errors..
Failed to load resource: net::ERR_INSECURE_RESPONSE
I am assuming you're using Chrome.
If so, the root problem is a certificate mismatch / expired certificate.
You can see this for yourself in the code here.
Note in particular the use of the very constant you reference in the code on line 48 of the C++ file I sent you:
case net::ERR_INSECURE_RESPONSE:
The current version of this file is here. The error status ERR_INSECURE_RESPONSE may not any longer be on line 48 but the error code still exists in the SSL certificate portion of the code.
Note:
Make sure to use the hostname which is listed in the SSL certificate, chrome automatically switches to the right hostname if you are browsing but not when using javascript.
The supplied host is not resolving for me (custom DNS or self configured host?) so I can only hazard to guess.
But as you are requesting the resources over SSL it is likely the certificate is invalid. Either it is self-signed and has not been added to your browser/OS exceptions or it is otherwise invalid.
Try the URI directly in the same browser and inspect the certificate.
Edit: this is in no way related to jQuery, JavaScript or CSS directly.
I had this problem with chrome when I was working on a WordPress site. I added this code
$_SERVER['HTTPS'] = false;
into the theme's functions.php file - it asks you to log in again when you save the file but once it's logged in it works straight away.
This can also happen if you have Chrome update automatically. Open Check chrome://help. The status should be:
Google Chrome is up to date.
Sometimes the status is requesting for a Chrome restart. In this case I had similar issues with several resources failing to load due to net::ERR_INSECURE_RESPONSE. After restarting Chrome, everything worked normally.
When I had the problem recently it was a cross site issue where our dev server hosts our analytics software as well as the application. In the other environments the chrome console would show this error and the javascript file (tracker) on the dev server as the source. This was causing issues for QA personnel who were trying to view the analytics data for their environment (nothing was being captured because of this issue).
The solution to fix this in-house was to add the SSL certificate the DEV site was using to the Trusted People store on the QA people's machine.
If this was a problem in production I would most likely move the javascript into the actual web apps.
Try to open it in an incognito window. I hope this will help. Alternatively, you could modify application/.htaccess like so:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
In my case, sometimes when i tests my MVC project by a localhost https url (E.g. https://localhost:44373/), the Chrome raise this error: net::ERR_INSECURE_RESPONSE for the website resources (such as JS files).
So i resolve it by Clear Cache. Then i refresh the page and Chrome show me a special page about insecure url and i just allow it by click on Proceed to localhost (unsafe).
Learn about CORS, try crossorigin.me is work fine
Example:
https://crossorigin.me/https://fr.s.us/js/jquery-ui.css
Not show a message error and continue page white, u need see error is try
http://cors.io/?u=https://fr.s.us/js/jquery-ui.css
enjoin us ;-)
For me the problem was the <base href="https://domain.ext/"> tag.
After removing, it was OK. Cannot really understand why it was a problem.
You are trying to get data from an https that does not have certificate. Change "https://" to "http://". Worked for me.
It was on Chrome for Android in my case.
All the static files served from a CDN with a CNAME that's SSL encrypted were not showing up. On Chrome desktop, it all showed fine.
Broken SSL cert
When I properly added the certs in ca_bundle the files displayed correctly.
Chrome for Android takes encryption seriously unlike Desktop.
I hope this saves you time and stress
If you use chrome, you can make a shortcut,right click and edit the shortcut's target, append this after target's string:
--ignore-certificate-errors
The complete string looks like this:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ignore-certificate-errors
Encode and make it like this: $_GET[].
My goal is to implement the following scheme using the subdomain and path as attributes:
Use a wildcard DNS entry that routes any subdomain to the root site:
Example:
*.example.com
ex: http://xyz.example.com
to
http://example.com
Next I want to rewrite the requests to point to a specific page, passing both the subdomain and the request path as attributes.
Example:
http://xyz123.example.com/images/header.jpg
to
http://example.com/get.aspx?id=xyz123&path=/images/header.jpg
I've seen several questions on here regarding similar goals, but not quite the same. I'm new to using rewrite rules, so any help is appreciated. I will update this as I make progress.
for IIS7, url rewrite functionality is built-in. Rules are set in web.config. For IIS6 you need an ISAPI dll that does the same for you. Use IIRF, it works just fine.
I have my website running at:
www.example.com
I also have this other domain:
www.example.net
Is it possible to point "www.example.net" to a subdirectory of "www.example.com"? For example:
www.example.net-> www.example.com/other
?
It's not just a redirect, I need to serve the pages and see "www.example.net" in the user's browser.
What do you think?
We use IIS7 and everything is ASP.NET (aspx pages, ascx controls, etc).
Using ISAPI Rewrite
[ISAPI_Rewrite]
RewriteCond Host: (?:www\.)?other\.com
RewriteRule (.*) http://www.domain.com/other$1 [I,L]
You're looking at two methods for this:
URL rewriter
Server.Execute method
The first is a httpmodule that silently redirects the request without changing the url in the address bar, the second is a method you can call within aspx code. I think the latter is only good though if you're working in the same application, so I would go with the URL rewriter.
There is an official iis7 URL rewriter available on www.iis.net afaik.
-Oisin
Two questions for you:
Can you set them up as two different web sites in IIS?
If someone visited example.net/page.htm, would that be the same as example.com/other/page.htm?
If the answer is yes to both of those, why not just setup a new web site in IIS and point it to the "other" file path.
How do I rewrite a URL in ASP.NET?
I would like users to be able to go to
http://www.website.com/users/smith
instead of
http://www.website.com/?user=smith
Try the Managed Fusion Url Rewriter and Reverse Proxy:
http://urlrewriter.codeplex.com
The rule for rewriting this would be:
# clean up old rules and forward to new URL
RewriteRule ^/?user=(.*) /users/$1 [NC,R=301]
# rewrite the rule internally
RewriteRule ^/users/(.*) /?user=$1 [NC,L]
Microsoft now ships an official URL Rewriting Module for IIS: http://www.iis.net/download/urlrewrite
It supports most types of rewriting including setting server variables and wildcards.
It also will exist on all Azure web instances out of the box.
I have used an httpmodule for url rewriting from www.urlrewriting.net with great success (albeit I believe a much earlier, simpler version)
If you have very few actual rewriting rules then url mappings built in to .NET 2.0 are probably an easier option, there are a few write ups of these on the web, the 4guysfromrolla one seems fairly exhaustive but as you can see they don't support regular expression mappings are are as such rendered fairly useless in a dynamic environment (assuming "smith" in your example is not a special case then these would be of no use)