GitHub Pages site - redirect from www - github-pages

I have github pages site. For example mysite.github.io. When I open www.mysite.github.io it doesn't work. I want both of them to work.
Is it possible to redirect www.mysite.github.io to mysite.github.io?
[EDIT]
I use free github account.
For more information read About GitHub Pages >> Types of GitHub Pages sites.

Well, to the best of my knowledge, that's not possible.
Only github can do that if they want to. I don't think that it's in our hand to make this redirect. It simply throws a 404.
Instead of doing this, consider buying a custom domain from a domain registrar.
After that, you'll probably be able to redirect from www.example.com to example.com
You can go for godaddy, hostgator or any other domain registrar if you want to buy a domain for your project.

What #daman-arora said is correct, that to redirect to mysite.com from www.mysite.com,but at first you will need to buy a custom domain.
 But I want to say that you still can redirect from www.mysite.github.io to mysite.github.io by this simple trick:
Create a new repository named www.mysite.github.io.
Then create an index.html file.
And then put the redirection code in the file:
<meta http-equiv="refresh" content="0; url=https://mysite.github.io">
Problems of redirection:
Very old browsers might not redirect to the page you want.
And if you use JavaScript redirection on your page, then it will not be redirected if JavaScript is disabled in users device.
Solution:
 You can add "Please click here if you are not redirected" to your page, so that users can click on the link and can go to the site, if not redirected automatically.

Related

How to remove repository name from a custom domain hosted in Github Pages?

I have made a NameCheap domain and linked it to GitHub pages properly.
If the site is live at a.me/resume, how can I make it just a.me and remove the repository's name from the url?
Open the repository and go to settings - pages - scroll down to the custom domain section and enter your custom domain and click save. You'll want to delete the old CNAME because when you save the custom domain it should create a new CNAME automatically.
I would also recommend verifying the custom domain you want to use with GitHub if you haven't already done so as a preventative measure to discourage domain squatters from using it. For that you'll just need to go to your account settings - pages - add a domain.
In order to verify the custom domain with GitHub, you'll need to add the verification code they give you to your DNS configuration as a TXT file.
https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/verifying-your-custom-domain-for-github-pages

Change sitecore admin url /sitecore

Is it possible to change the admin url from /sitecore to anything else so that not anyone know the admin access url of site. If yes then how it can be done.
I don't recommend you to change admin url.
You can restrict access to Sitecore Client in different ways.
Please check official Sitecore document about restricting access to the Sitecore client interface.
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/security_and_administration/access_rights/restrict_access_to_the_client
You should not change that URL. It will be better if you will split your environments into Content Delivery and Content Management.
Content Management should not be accessible for someone outside your company.
Content Delivery does not have /sitecore login page.
It means that if you will use correct architecture for your environment You will no have to change the url of login page.
Restricting access via IIS config is the way to go here, renaming the folder is not advised.
This might be what you're looking for:
https://community.sitecore.net/developers/f/8/t/2965
Add to your redirect in the .config file as mentioned in the link. And remove the old one.

Redirect Human User, but not Facebook Crawler

I have a simple Django site, with 2 pages. It is kind of like those stupid buzzfeed quizzes. There is a questions page (www.mypage.com), and a results page (www.mysite.com/results/myResults). I am trying to use the facebook share button to drive social sharing. I want people to share the results page (e.g. "I got this result, what about you?"), but I need incoming users clicking these shared links to be redirected to the main questions page.
I have tried adding a URL parameter www.mysite.com/results/myResults?fromShare = T and using a view to redirect these to the main page. However, the facebook crawler also gets redirected, so the shared content ends up being the main page, rather than the individualized results page.
tl;dr: how do I redirect incoming human users, while not redirecting the facebook crawler? I would ideally like to do this in a django view, rather than .htaccess.
Facebook user agent will be one of these:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.0 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.0 (+https://www.facebook.com/externalhit_uatext.php)
Look for these in request.META['HTTP_USER_AGENT'] and redirect.
In your view, look at request.META['HTTP_USER_AGENT'], compare it to Facebook crawler's, and redirect if it doesn't match. If it does match, serve your page template.

Need to track what websites a user visits after leaving my site

I would like to track what websites my site's visitors go to after they leave.
Would it be possible to place a cookie on their browser when they visit my site, and then later if they go to Facebook.com or stackoverflow.com, my cookie will retreive the browser's URL data and send it back to my server.
I could then look at this data and know that my visitors had gone to Facebook.com and stackoverflow.com after they left my site.
Is this possible using cookies?
Thanks for the help.
No. Cookies are not executed or anything. They are just dumb bits of data.
You would need to be able to execute code on the page they are visiting afterwards.
What I presume you are trying to ask, is that you want to track your outbound links.
This is mainly done with Javascript: You need to intercept click events from outbound anchor links, and send an event notification as described here, or using the hitCallbackmethod prior to completing the redirection to the external website. For Google Analytics see documentation. Or you could do via a custom JS implementation sending the info back to your server instead.
Alternatively your could replace all outbound links on the server side in your html source, and have all links pointed to your server first, and redirected to the external sites. But using redirects for this purpose is not really a good recommendation, unless you are an ad networks or a search engine company requiring such method.
Lastly, there is an alternative method using the HTML5 'ping' attribute. But the feature has been either removed and/or not yet fully implemented across all browsers as of this writing.
But you can't track where your visitors go beyond the 1st level outbound links of your site.

How do I allow users to map their domains to a url on my site?

How do I allow users to map their domains to a url on my site? (like how tumblr or blogger does)
The app is being developed in Django. I want the users to be able to map their domains to mydomain.com/username (is this possible or do I need to have a format like username.mydomain.com?)
Also my app runs on a VPS so I have my nameservers as ns1.mydomain.com and ns2.mydomain.com.
easiest way is through domain cloaking. most domain name providers will allow users this option.
another easy idea is to provide your users with a very generic html page that just includes their url on your site in an iframe and have them places that as their default directory index (e.g. index.html).
both the aforementioned would always show the base domain (without trickery). as noted below, a CNAME DNS record would take care of this, assuming they have the ability to edit DNS records...
www.someuserdomain.com. CNAME username.yoursite.com
In that case, you will have to consult your specific hosting setup for how to programmatically change your DNS settings. Whether you can actually do this depends on the host. If your server is running a DNS server that you have access to, you can probably change it that way.