EzDevInfo.com

subdomain interview questions

Top subdomain frequently asked interview questions

.htaccess rewrite subdomain to directory

Is it possible to use .htaccess to rewrite a sub domain to a directory?

Example:

shows the content of


Source: (StackOverflow)

PHP function to get the subdomain of a URL

Is there a function in PHP to get the name of the subdomain?

In the following example I would like to get the "en" part of the URL:

en.example.com

Source: (StackOverflow)

Advertisements

Should I delete the cgi-bin folder in a subdomain I just created?

Using cpanel on my hosting account, I created a subdomain - e.g. www.clothing.mysite.com

A cgi-bin folder was automatically created in the directory for clothing.mysite.com. Do I need it? I'm only using the subdomain to install wordpress on it. I don't really understand what the cgi-bin folder is for and I'm happy to leave it if it doesn't harm anything. Any thoughts? Thanks guys!


Source: (StackOverflow)

How do I get a list of all subdomains of a domain? [closed]

I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:

dig @ns1.foo.bar some_domain.com axfr

But this never works. Has anyone a better idea/approach


Source: (StackOverflow)

use localStorage across subdomains

I'm replacing cookies with localStorage on browsers that can support it (anyone but IE). The problem is site.com and www.site.com store their own separate localStorage objects. I believe www is considered a subdomain (a stupid decision if you ask me). If a user was originally on site.com and decides to type in www.site.com on her next visit, all her personal data will be inaccessible. How do I get all my "subdomains" to share the same localStorage as the main domain?


Source: (StackOverflow)

Buying SSL certificate for only one subdomain? [closed]

Is it possible to buy an SSL certificate for only one subdomain? I mean I have no certificate on mydomain.com but I want to use one on sub.mydomain.com. Do I have to buy for both main domain and subdomain?


Source: (StackOverflow)

IIS 7 SSL for multiple sites with a single IP

I have a single IIS 7 server with a single IP address. Site 1 has an SSL cert for www and Site 2 has a wildcard SSL cert for various subdomains. Both sites use host headers to direct traffic off the single IP address. However, when I try to access a subdomain on Site 2 I see a browser warning telling me that the SSL cert is wrong and shows me the information for Site 1. Help!


Source: (StackOverflow)

Javascript Redirect with Google Analytics

I need help figuring out how to successfully redirect while including Analytics code.

The code for that redirect file:

<head>
<script type="text/javascript">
function delayedRedirect(){
    window.location = "https://market.android.com/developer?pub=Fractal%20Systems"
}
</script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1234567-8']); <!--I have my real ID there-->
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body onLoad="setTimeout('delayedRedirect()', 3000)">
<h2>ADW.BuuF.Theme is no more! You will be redirected to new and better apps in 3 seconds.</h2>
</body>
</html>

This works as a redirect only if I don't include my Analytics code. I've tried moving the code around with no change.

QUESTION How can I add a redirect, of any kind, and still be able to track with Google Analytics?

I've tried PHP redirects with no success and am pretty sure htaccess redirects wont help although I'm open to suggestions.

The reason I'm using a JavaScript redirect is so I can continue to track with Google Analytics and also show a little message or make a custom page with the delay.

Thanks for any help. Doesn't have to be JS, please, any input is welcome if you know of a solution.


Source: (StackOverflow)

Problems with SSL and multi level subdomains

I have a wildcard SSL from Godaddy. When I go here:

https://conciergelive.conciergeliveapp.com/users_session/new

Everything is fine. But when I go here:

https://es.conciergelive.conciergeliveapp.com/users_session/new

I get a security alert. I need the extra subdomain to determine locality. Any ideas why this does not work?


Source: (StackOverflow)

Redirect 'myapp.com' to 'www.myapp.com' in rails without using htaccess?

Using Morph Labs' Appspace to deploy a site means no automated way to redirect 'myapp.com' to 'www.myapp.com' (and no access to .htacess).

Is there an in-rails way to do this? Would I need a plugin like subdomain-fu?

More specifically, I'm trying to do something like:

  • 'myapp.com' => 'www.myapp.com'
  • 'myapp.com/session/new' => 'www.myapp.com/session/new'

Basically, I always want the 'www' subdomain prepended on every request (because the SSL cert specifically has a common name of 'www.myapp.com').


Source: (StackOverflow)

MVC 3 Subdomain Routing [duplicate]

Possible Duplicate:
Is it possible to make an ASP.NET MVC route based on a subdomain?

In asp.net MVC 3 site i'd like to create online stores for users. Any store that is created by user should have a URL like "shopname.mydomain.com".

I tried some routing work but failed at all. I am researching for a solution but cannot find any proper solution.

My purpose is that; if I can add a route to manage any request that tries to find a subdomain I will check if it is a user online shop name and get the dynamic data on play.

Need routing help :) Thanks.


Source: (StackOverflow)

*.mydomain.com - A record or CNAME?

Some people are saying use an A record and others a CNAME for a catch all subdomain.

Which should I use and why?


Source: (StackOverflow)

In a django web application, how do you give users their own subdomain?

I'm starting a new web app project using Django and Pinax. I want to be able to give my users unique domain names like Wordpress and other sites do : username.wordpress.com. I'm not sure how to approach this with Django, since the url parsing logic (in urls.py) starts with the url AFTER the domain name.

More specifically, there will be multiple groups of users, each group having a unique name. Not sure that makes a difference, but I thought I should mention that.

Is there some way I can manipulate the http request so that the URL looks to Django as if the url were something like www.domain.com/groupname, but still showed in the browser address bar as groupname.domain.com?


Source: (StackOverflow)

Rails rspec set subdomain

I am using rSpec for testing my application. In my application controller I have a method like so:

def set_current_account
  @current_account ||= Account.find_by_subdomain(request.subdomains.first)
end

Is it possible to set the request.subdomain in my spec? Maybe in the before block? I am new to rSpec so any advice on this would be great thanks.

Eef


Source: (StackOverflow)

Can HTML5 databases and localStorage be shared across subdomains?

I am attempting to share data across subdomains using Safari. I would like to use an HTML5 database (specifically localStorage as my data is nothing but key-value pairs). However, it seems as though data stored to domain.com can not be accessed from sub.domain.com (or vice versa). Is there any way to share a single database in this situation?


Source: (StackOverflow)