it is posible to get anotehr address from using pre-name on url? - html

If for example I have site call
xyz.com
how can I force my server(Asp.net/iis)
to go to another page if i ask for
a.xyz.com
it is posible?
for example: m.xyz.com leads to xyz.com/mobile.aspx
thanks!

The solution involves multiple steps:
You need to configure the subdomain in your DNS.
You need to create a website in IIS to handle the subdomain. There's a guide here on how to do this. Pay attention to the "Host Header" part - That's where you set you m.xyz.com address.
You need to setup an HTTP redirect (301 / 302). You can do this from the config file with the httpRedirect element (More details here).

Related

How do I protect a directory within github-pages?

I am building my personal website using Jekyll and hosting it at github-pages. I would like to have a password protected area (just password protected directory, not the whole website). I have tried a few options and tricks to get htaccess to work but failed.
I would like to know if someone managed to use htaccess, or any other method, to protect a directory on github-pages.
Listing solutions which did not work for me (or I failed to get them to work):
*Flohei.
*Jeremy Ricketts.
GitHubPages (like Bitbucket Pages and GitLab Pages) only serve static pages, so the only solution is something client side (Javascript).
A solution could be, instead of using real authentication, just to share only a secret (password) with all the authorized persons and implement one of the following scheme:
put all the private files in a (not listed) subdirectory and name that with the hash of the chosen password. The index page asks you (with Javascript) for the password and build the correct start link calculating the hash.
See for example: https://github.com/matteobrusa/Password-protection-for-static-pages
PRO:
Very simple approach protecting a whole subdirectory tree
CONS:
possible attack: sniffing the following requests to obtain the name of the subdirectory
the admins on the hosting site have access to the full contents
crypt the page with password and decrypt on the fly with javascript
see for example: https://github.com/robinmoisson/staticrypt
PRO: no plaintext page code around (decrypting happens on the client side)
CONS:
just a single page, and need to reinsert the password on every refresh
an admin could change your Javascript code to obtain the password when you insert it
One option is to use Cloudflare Access to control access at the DNS level.
After setting up a custom domain for your Git pages using Cloudflare for DNS, you can use their Access rules policy to require authentication at the specified url path.
This could still be bypassed if someone is familiar with bypassing DNS blocks.
https://www.cloudflare.com/products/cloudflare-access/
You can give a try to Jekyll Auth and if you run into troubles, this issue can be useful.
You can use Render to deploy your static Web app. It has a npm package that encrypted your html files and user can not see it in browser. So you can use frontend password validation.

Website Redirect Alternative - Two URLs to use same code base

Currently I have a redirect setup in my domain host's dns for example2.com to goto example.com
I don't want it to redirect but rather stay as example2.com while displaying the exact content from example.com. I don't want to copy the site's code between the two. I want a single code base and both URL's to use the same code.
I am not sure how to achieve this using my web host's CPanel. I thought I might be able to do it using cnames or aliases but that does not seem to work. I am sure someone has had this experience before.
I believe this is a pseudo-programming question but if a mod decides this is the wrong stack please do move it.
303 headers need to be sent with a new domain or in this case example.com, for apache or php related steps see these links:
http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url
redirect to a page without changing the url
Redirecting to HTTP error documents without changing the request URL
For explanations:
http://en.wikipedia.org/wiki/URL_redirection
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

Multitenancy and Subdomains in Orchard

Crosspost: https://orchard.codeplex.com/discussions/455071
I'm using Orchard 1.6.1.
Say my first site is called domain.com. I tried to create a new tenant and put the beta.domain.com as the Host with no URL prefix (seeing that it is Optional).
The url http://beta.domain.com is shown and when I try to Set Up, it doesn't show anything. I tried to remove the subdomain and enter a prefix which resulted in http://domain.com/beta. It worked, however, I would very much prefer a subdomain as shown/detailed here: http://docs.orchardproject.net/Documentation/Setting-up-a-multi-tenant-orchard-site
Do I have to set it up in my DNS server?
Any piece of advise or information would be highly appreciated. Thanks!
If you have an IIS server, you will need to have your beta.domain.com point at it and then add a binding to your website in iis of beta.domain.com for it to pick it up.
If you're using shared hosting and you don't have access to IIS. Then you should use Domain Aliases (in Plesk) rather than setting the DNS. It would make your Orchard CMS on your primary domain serve the tenant site.
Example: You want to add a tenant site on tenant.mysite.com then you should add a domain alias tenant.mysite.com to mysite.com domain. Don't forget to check the Web option if using Plesk.
In case of you have access to IIS, you need to add binding to your primary domain.

difference between http and www

pardon me for asking a very basic doubt.
I have hosted a page in the site collinfo.annauniv.edu
The page opens fine when i enter the address as http://collinfo.annauniv.edu
But when i gave www.collinfo.annauniv.edu my browser shows 404 error.
What is the difference that http causes here in place of www.
The www. before your domain is actually a subdomain. It's essentially the same thing as help.microsoft.com or orders.amazon.com.
With that in mind, there are a few things that could be happening:
1) Your DNS records do not include the appropriate A Record for the www subdomain.
In this case, you'll need to setup an A record that points to your web site's IP address. If you don't know how to do this, your web host should be able to help.
2) Your server is not configured to handle the www subdomain.
If you're using the apache web server, it needs to be configured to show your web site when the user enters www before your domain. Again, your web host can set this up for you.
It all comes down to a misconfiguration issue. If you don't have experience administering web servers, you may want to give your web host a holler.
www comes from the (rather) old time where a domain had several sub-features, of which the web was not always the main service. For instance
www.domain.tld for web
mail.domain.tld for mail
ftp.domain.tld for ftp
domain.tld for web
but this is a convention - any subdomain may point to anything actually.
This is more a question of DNS declaration and/or web-server configuration ; in this case it is probably that the web-server configuration does not trigger the same pages for www.domain and domain (since you get a 404).
The author / administrator of collinfo.annauniv.edu either forgot to create a DNS entry for www.collinfo.annauniv.edu or did not create a virtual domain (web-server side) for it that would point to the same pages as collinfo.annauniv.edu.
HTTP is a protocol.
http://collinfo.annauniv.edu
Is the address of a resource which can be retrieved using HTTP.
annauniv.edu is the domain in your case.
collinfo is the subdomain.
www.collinfo is also considered as a subdomain but it does not exist. That's why you get HTTP 404 not found.
Subdomain can be anything, www is usually used as it usually mean World Wide Web.
WWW is a subdomain
HTTP is a protocol (language)
Whether you specify HTTP in the browser or not, the browser will always assume the request is being of "http" type and will ussually add http:// for you.
WWW however is just an alternative subdivision of the domain name, the same as in:
www.domain.com
site.domain.com
sub1.domain.com
sub2.domain.com
.....
etc.domain.com
In most cases the WWW subdomain will point to the same "page" as the main domain, which is usually called the "index" page, such as index.html, or index.php and in most cases the index page is hidden in the browser's address bar, unless you specifically type it in, such as http://www.yahoo.com/index.html, but you have to understand that if you have a full control of your webserver you can modify these, so WWW doesn't point to the same page or you can call you main page "home.html" instead of "index.html" and instruct your webserver to "point" your browswer to that page by default.
But things like HTTP are not easily changed, since HTTP is the main language of the web and most browswers use that as the primary means to access the webservers.
Peace!

Redirected Domain Problem

We have 2 different websites. One is xy.com another is xyz.com. The domain xyz.com is redirected to a folder on xy.com\one
This works fine. Now we want a particular link to be opened (for example, www.xyz.com\abc.html). I am placing this file in xy.com\one\abc.html. But when I enter this url, it takes me to home page, instead of abc.html. Though I can open abc.html, by entering www.xy.com\one\abc.html.
I need to open this file, from link, www.xyz.com\abc.html. How to accomplish this??
Regards,
Rahul Jain
I think the problem is your slashes are reversed. Did you keep your url's near a strong magnet?
If you are using apache you might want to have a look at mod_rewrite. There are similar methods available for other servers.
Would be good to know which environment you are using (web server and server side language) and if you are applying the re-direct rules in a programmatic way or via server configuration.
To give a serious reply, there could be several things wrong in the redirect.
You have to setup a redirect from the old domain to the new, by using a .htaccess on the old domain, changing the DNS records for the domain, or probably some other alternatives. Which of these have you used?
In case of the second option the receiving server (xy.com) has to accept the incoming domain (xyz.com). When I set my DNS records for a domain to go to a certain server, I have to actually setup the server to accept that domain, usually by "parking" it in Cpanel. Some hosts charge per parked domain, which is why they don't accept the incoming traffic automatically.
Depending on the method used, the receiving server has to be told what to do with the request.
So most importantly: HOW did you set up the redirect? Was it a DNS record? Was it a htaccess on the side of xy.com? Any other methods? (sorry, this isn't really an answer either but it was too long for the comments)