23331

Showing a GitHub project page only under custom subdomain, never via folder path

Question:

I have an organization GitHub Pages repository set up, and it's served through a custom domain name (let's say, <a href="http://example.com/" rel="nofollow">http://example.com/</a>).

I also have a couple of projects pages which I want to be accessible via a subdomain only (let's say, <a href="http://project.example.com/" rel="nofollow">http://project.example.com/</a>), but it turns out that they will also be accessible at a different URL (that is, <a href="http://example.com/projectname/" rel="nofollow">http://example.com/projectname/</a>).

Is there any way to avoid this? Both the organization pages and the project pages have CNAME entries set up, and the DNS records seem to be correctly configured.

Answer1:

<blockquote>

<a href="http://project.example.com/" rel="nofollow">http://project.example.com/</a> will also be accessible at <a href="http://example.com/projectname/" rel="nofollow">http://example.com/projectname/</a>

> <strong>Is there any way to avoid this?</strong>

</blockquote>

I was able to avoid this via a <a href="https://help.github.com/articles/user-organization-and-project-pages/#project-pages" rel="nofollow">project pages</a> setup for each <em>subdomain</em> as well as the <em>domain</em>. It didn't work with CNAME records so I had to use A records in the server side configuration. Every record would point to the Github IPs <strong>192.30.252.153</strong> and <strong>192.30.252.154</strong>, using the subdomain as host or @ for the domain.com part.

<img alt="Example" class="b-lazy" data-src="https://i.stack.imgur.com/Pw0kQ.png" data-original="https://i.stack.imgur.com/Pw0kQ.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

For future users looking into <a href="https://help.github.com/articles/about-custom-domains-for-github-pages-sites/" rel="nofollow">how to map a Github page</a> to a domain / subdomain:

<ol><li><a href="https://github.com/new" rel="nofollow">Create new</a> Github repo and add a gh-pages branch.</li> <li>Add your index.html and a CNAME file with only one line sub.domain.tld.</li> </ol>

See <a href="https://gist.github.com/bucaran/294b9b8839ebdf5343f2" rel="nofollow">this gist</a> for more details.

Answer2:

The only solution that I am aware of is hiding http://domain.tld/projectname/ content with a robots.txt file on the web server that serves that domain.

<a href="http://en.wikipedia.org/wiki/Robots_exclusion_standard" rel="nofollow">http://en.wikipedia.org/wiki/Robots_exclusion_standard</a>

Recommend

  • Multi-tenant Azure dynamic wildcard CName
  • deploying Node.js app for production
  • Rewriting Amazon S3 static urls [closed]
  • Domain name setup with AWS S3 bucket with static hosting
  • Objective-C : getting error on console while trying to display app on ipad device?
  • Weighted round robin dns between 2 Cloudfront distributions
  • Checking whether the server is on/off
  • DNS Lookup failed - Error with all browsers [closed]
  • How to use ResourceDictionary in Windows Phone class library project
  • Cordova Apache wrong module path
  • How do you keep a running instance for Google App Engine
  • ASPNetCore MVC Routing Let Server Handle Specific Route
  • SQL: Getting the physical size of a subset of a table
  • Prevent page break in text block with iText, XMLWorker
  • Python 3.2.2, error(scripts to exe)
  • NSIS decompiler
  • How can I get the choice “H2” back in the H2 consol?
  • How do I remove all but some records based on a threshold?
  • How do I get the list of bad records that didn't load in Bigquery?
  • Prevent Tomcat from caching request during starup
  • How do I shift the decimal place in Python?
  • Multicolored edittext hint
  • Redux Form - Not able to type anything in input
  • Sequential (transactional) API calls in angular 4 with state management
  • how to avoid repetitive constructor in children
  • Problem while Building a Setup Project for a windows Service?
  • How to get Eclipse Oxygen to run on Java 9
  • How can I sort a a table with VBA with given text condition?
  • Django: Count of Group Elements
  • All Classes Conforming to Protocol Inherit Default Implementation
  • Control modification in presentation layer
  • Android screen density dpi vs ppi
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • need help with bizarre java.net.HttpURLConnection behavior
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize