Making subdomain open the subdomain.php

Discussion in 'DNS/Domain names' started by ashkan101, May 3, 2015.

  1. Hello . I have this website : luminous-international.com
    And I made this sub-domain for it (from Control panel) : store.luminous-international.com
    When I write luminous-international.com in a browser, It opens index.php
    I want it to open the store.php whenever i write store.luminous-international.com.
    for now it shows index.php whenever i write store.luminous-international.com
     
    Last edited: May 3, 2015
  2. Last edited: Oct 14, 2015
  3. I do not want to use asp I want to redirect to a php page
    this is the code I have in index.asp with no result :
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("http://store.luminous-international.com") ) > 0 Then
    Response.Redirect("/index.php")
    End If
    %>

    edit : it worked I just had to remove the http or add another if statement without http.
     
    Last edited: May 4, 2015
  4. now problem is that whenever i refresh the page on sub domain it redirects to the main domain
     
  5. Yeah, you don't want to add http:// to the statement.

    The code you posted is telling your subdomain to redirect to the main site. index.php should be store.php.

    Unless your store only consists of one page - store.php - it might be better to put your store files in a /store subdirectory and redirect to that:

    Code:
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("store.luminous-international.com") ) > 0 Then
      Response.Redirect("/store")
    End If
    %>

    If your store is all in that one file, this should work:

    Code:
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("store.luminous-international.com") ) > 0 Then
      Response.Redirect("/store.php")
    End If
    %>
     
    ComputerMan likes this.
  6. All right thank you so much . everything works great this time . the only other thing I need is to hide the name of the store.php, So in the URL bar of the clients browser I want to show 'store.luminous-international.com' instead of 'store.luminous-international.com/store.php'. do you think is it possible to hide the file name using web.config or any other method?
     
  7. You could try adding store.php to your list of Default Documents. Those are the files that open when your URL doesn't include a file name - like index, default, home, etc.

    You do that with IIS Manager. Here's a Knowledge Base article: Using the Microsoft IIS Manager
     
    Last edited: Oct 14, 2015
  8. what do you mean? declaring a page as a default page in IIS doesn't hide it's name.
     
  9. you wanted me to set the index.asp as the first default page. and then use index.asp to redirect the user to index.php and now you want me to redirect the user to the root URL which is set to open index.asp so if i redirect from index.asp to index.asp forever nothing will get beter . please do not post things that you never tested before
     
  10. It does if the URL doesn't include the file name. http://www.Winhost.com and http://www.Winhost.com/home.aspx display the same file. But because home.aspx is a default document, the URL without the file name does not display the file name.

    But I see what you mean in your case, and yes, if you're redirecting to the store.php file - or any file - you'll see the file name since the file name is included in the redirect.

    The idea of making store.php a default document would allow you to redirect to a directory that contained your store.php file, which would show your subdomain URL without the file name. If you redirect store.luminous-international.com to /store and store.php is a default document in /store the store.php file should open as store.luminous-international.com without the file name.

    If store.php has to live in the root directory the file name is going to have to be part of the URL.
     
    Last edited: Oct 14, 2015

Share This Page