htaccess problem - .htaccess

i have to write htaccess for mysite. actually we have two domains. '.com and .in' . for example i opened '.com' site it will actomatically access files from '.in' domain. there is no files in .com site. how to write .htaccess for this.
thanks.

If you have access to the web server, use the configuration to archieve this. In case of apache2, it would just require a server alias in the virtual host. Otherwise, use redirects or url rewriting.
If you cannot use them either (because you are on a limited virtual environment, f.e.), place an index.html in your .com directory, configure it to redirect via meta-refresh tag. Place the following line in the header section of your index.html:
<meta http-equiv="refresh" content="0; URL=http://yourinsite.in/">
Then use the DirectoryIndex directive on a .htaccess file to automatically load it as default index page:
DirectoryIndex index.html
This brings up the index.html when the user browses yoursite.com/ and lead her to yourinsite.in automatically.

Do you have access to the server config? Judging by your comment above what you actually want is to setup a server alias, where the .com and .in sites are the same? This will make the .com site load the .in or vice versa.

Another solution you could use if you don't have server access it use a domain frame cloak, which will keep the .com URL in the address bar but load the .in site inside a frame, put this code in index.html on the .com site, fill in what toy need to.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>TITLE OF THE SITE</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Description" content="Description of the site"
</head>
<frameset rows="100%,*">
<frame frameborder="0" src="http://domain.in" scrolling="auto">
<noframes>
<body>
<p><b>Welcome on our site. Your browser do not support frames.</b></p>
<p>Click here to go to the page.</p>
</body>
</noframes>
</frameset>
</html>

Related

How do I write my NodeJS server to an existing domain?

Okay so I'm in like a really weird spot.
I need to set up a nodejs server for a messaging app, and I want to put the server on a url I already have. I have full access my directory on that site (ex. I can access sitename.com/~mypage/) and do things with it through filezilla, but I cannot access the hardware or the base domain (ex. I can't touch sitename.com but I can access ~mypage).
how would I set up the server on there? Do I need to initialize it on my own computer then upload it or do I install nodejs on the server and initialize it there? or can I use a local host for the app? Thanks.
if you already have a site running you won't be able to just slot a node app into ~mypage by adding it through filezilla.
The best way to do this in my opinion is by setting up through your domain management that ~mypage points to where you have deployed your node app (ie heroku, AWS), but if you have access to do that you may as well set up a subdomain to route to the app (ie app.sitename.com)
However, if you really cant access the domain settings, my suggestion would be to deploy your node app on Heroku, AWS or GCP then either:
A) set up a a ~mypage that redirects you to your app url if someone visits it
OR
B) set up a page with masked forwarding like so (so the browser url stays as sitename.com/~mypage/):
<html>
<head>
<title>Page Title</title>
<META name="description" content="Page Description"><META name="keywords" content="keywords, for, page">
</head>
<frameset rows="100%,*" border="0">
<frame src="http://linktoyourapp.herokuapp.com" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
</html>

Default website image for social sharing - Issue

to get this done I found the below code on other post.
<meta property="og:image" content="http://example.com/logo.jpg">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1024">
<meta property="og:image:height" content="1024">
This works fine if I use http://example.com. But when I use www.mysite.com this is fetching another thumbnail.
Can anyone help me to get the same image when I access with www and without www as well?
It just took time. No issues with the code.

IIS paths ignoring application folder

I lack the know-how with IIS and IIS manager to even have the proper google terms here, so I hope you'll keep that in mind if you're tempted to click that downvote button.
Thanks.
Okay, so I have an angular application that I just moved over to an an IIS server after developing it locally, without using IIS.
The IIS-based copy of the application works, in that it will serve index.html as expected. Unfortunately, links to external files (.ccs, .js, etc) are all broken.
The application lives in this folder:
\\iis.dev.local\c$\inetpub\wwwroot\the-application
And it's .css file lives here:
\\iis.dev.local\c$\inetpub\wwwroot\the-application\css\main.css
As originally written, the link to that .css file, which we'll call "link 1":
<link rel="stylesheet" href="/css/main.css">
Which worked fine in development, but doesn't work on IIS.
However, this does work, which we'll call "link 2":
<link rel="stylesheet" href="/the-application/css/main.css">
See how I had to add the folder that the application itself sits in? Which is strange, because relative to index.html, "link 1" should be correct--but it isn't.
How can I convince my application that its base url should be the folder it's sitting in, and not one level above?
Random partial guesses and/or useful information?
1) The application sits in the default application pool.
2) Something, something web.config?
EDIT: screwed up some paths.
Try using the <base> HTML Element to set the root.
https://www.tutorialspoint.com/html/html_base_tag.htm
In your example it would be:
<base href="https://www.the-application.com" />
Then the rest should flow, with relative paths.
When developing on your local machine you are most likely running under a Virtual Folder under the DEFAULT website.
When you move to a server you are now running at the ROOT of the site.
Options:
Create a new site on your DEV Machine at the Root of IIS. Then use this path to test your site. When you migrate to production the paths will be the same.
Create a variable with the correct path, and if running LOCALHOST (in the url) use one path, else the other. Use JavaScript to add the link to your HTML (Something I have done with a JavaScript site under IIS for Cordova Development).
Change your page extension from .html to .aspx (yeah I know who wants to do that...) then change your links as follows. (I had to remove the starting < and ending /> in the code below, it would not format in the post)
link rel="Stylesheet" type="text/css" href="<%= ResolveUrl("~/css/main.css") %>"
When you browse your source afterward you will see... (or when you navigate to sub-pages it will put the correct relative path in place for you)
<link rel="Stylesheet" type="text/css" href="css/main.css"/>

Using htaccess to redirect the page but keep the URL structure and change the domain only

I have a dynamically part static and part dynamic url I wish to redirect to another page but keep part of the URL the same (domain).
My structure will be as follows:
www.domaina.com/query(folder)/?123,456,789
To redirect to
www.domainb.com/query(folder)/?123,456,789
But I wish to keep the URL in the address bar reading as domaina.com not domainb.com.
The sites are on different servers and htacces rules will differ from site to site (some may be static sites in the root and some maybe wordpress etc) and will sometimes be on different servers.
Thanks
Look into iFrames instead of doing this with htaccess code.
Edit|Update: Use iframes and not frameset. frameset is not supported in HTML5. See this w3schools tutorial page. Adding an iframe is very simple so keep everything very simple - http://www.w3schools.com/tags/tag_iframe.asp
<frameset rows="100%">
<frameset cols="100%">
<frame src="http://www.domain.com/page-i-want-to-display" frameborder="0" scrolling="yes">
</frameset>
</frameset>

HTTPS Security IE nokia maps

I'm using nokia maps in my html page by including this script (with https)
<script type="text/javascript" charset="UTF-8" src="https://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script>
If I access my site using https then it gives me the security warning message :
SEC7111: HTTPS security is compromised by http://1.maps.nlp.nokia.com/maptile....
How can i force the scripts to get the maps with https ?
This is a configuration issue. In order to fix it you have to add this line in your nokia here declaration :
nokia.Settings.set("secureConnection", "force");

Resources