1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to make a directory with a ? mark in it

Discussion in 'Cloaking and Content Generators' started by YoutubeSlanger, Jan 16, 2012.

  1. YoutubeSlanger

    YoutubeSlanger Junior Member

    Joined:
    Nov 9, 2011
    Messages:
    184
    Likes Received:
    22
    im looking to make directories with ? in it. how do I do this.


    for example youtsite.com/?mydirectory

    I am on hostgator, and I thought it was simple as just creating it but all that comes up is a blank
     
  2. sfidirectory

    sfidirectory Senior Member

    Joined:
    Mar 29, 2010
    Messages:
    902
    Likes Received:
    484
    Occupation:
    Web developer/BTC enthusiast
    Location:
    php artisan make:migration
    Home Page:
    I think your "mydirectory" needs a default index file in it, eg index.html, index.php, index.asp, index.shtml... Try doing that and let me know how you go. I've been wondering myself, which is embarrassing since I have been doing web development since 2007.

    EDIT: I put "/?" on the end of one of my site's urls and I got shown the home page (which is obviously the index page).
     
    • Thanks Thanks x 1
    Last edited: Jan 16, 2012
  3. Corrupt

    Corrupt BANNED BANNED

    Joined:
    Sep 15, 2011
    Messages:
    805
    Likes Received:
    412
    I haven't done it myself, but I believe it can be done by using mod_rewrite in .htaccess.

    EDIT:
    See this:
    Code:
    http://corz.org/serv/tricks/htaccess2.php
    Just rewriting the ?directory to directory should work. Lemme know how it goes.
     
    • Thanks Thanks x 1
    Last edited: Jan 16, 2012
  4. hi.imandrew

    hi.imandrew Junior Member

    Joined:
    Nov 22, 2009
    Messages:
    159
    Likes Received:
    42
    Location:
    Arkansas, USA
    .htaccess
    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . index.php [L]
    RewriteRule (.*) index.php?$1 [PT,QSA]
    </IfModule>
    
    index.php
    PHP:
    $page $_SERVER['argv'][0];
    //if pulling from a database, make sure to secure $page
    if (empty($page)){ $page "index.php"; }
    //Example http://mysite.com/?folder
    //$page will = 'folder'
     
    • Thanks Thanks x 2
  5. YoutubeSlanger

    YoutubeSlanger Junior Member

    Joined:
    Nov 9, 2011
    Messages:
    184
    Likes Received:
    22
    I couldent get this to work

    I placed the .htaccess in the directory named ? and created the index.php
    created a folder called lol with a index page and calling mysite.com/?lol nothing appeared.

    any help
     
  6. roamer

    roamer Power Member

    Joined:
    Dec 2, 2008
    Messages:
    500
    Likes Received:
    480
    Occupation:
    Gfx designer, vfx and mgfx
    Location:
    plɹoʍ ǝɥʇ punoɹɐ ƃuıɯɐoɹ
    The ? after the URL means that whatever variables follow are parsed by whatever engine the site runs on, ie. PHP, ASP, Perl. In short, not a valid directory character.
     
    • Thanks Thanks x 1
  7. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,228
    Occupation:
    Retired
    Location:
    Old Peoples Home
    • Thanks Thanks x 1
  8. YoutubeSlanger

    YoutubeSlanger Junior Member

    Joined:
    Nov 9, 2011
    Messages:
    184
    Likes Received:
    22
    I still aint getting it right

    this how my root looks

    folder
    lol

    .htacess
    index.php

    I call mydomain.com/?lol

    and nothing
     
  9. hi.imandrew

    hi.imandrew Junior Member

    Joined:
    Nov 22, 2009
    Messages:
    159
    Likes Received:
    42
    Location:
    Arkansas, USA
    index.php
    PHP:
    <?php
    $page 
    $_SERVER['argv'][0];
    if (!
    file_exists($page)){
     
    //check to make sure the file or directory exists, don't allow redirection to other websites.
     
    header("Location: main.htm");
     
    //redirect to this page by default
    }else{
     
    header("Location: $page");
    }
    die();
    //Examples:
    //http://mysite.com/?lol
    //will redirect you to http://mysite.com/lol
    //http://mysite.com/?test.php
    //will redirect you to http://mysite.com/test.php
    ?>
     
  10. YoutubeSlanger

    YoutubeSlanger Junior Member

    Joined:
    Nov 9, 2011
    Messages:
    184
    Likes Received:
    22
    thanks bro, I pmed you
     
  11. NOKENNY

    NOKENNY Newbie

    Joined:
    Mar 12, 2011
    Messages:
    21
    Likes Received:
    15
    Location:
    Barcelona
    if ur web site is static just create directories using your hosting file manager or a ftp program , but if you have a dynamic php script u should use the htaccess method
     
  12. hi.imandrew

    hi.imandrew Junior Member

    Joined:
    Nov 22, 2009
    Messages:
    159
    Likes Received:
    42
    Location:
    Arkansas, USA
    The way your wanting to do it, instead of redirecting, use an iframe, or preferred way, an include file.

    index.php
    PHP:
    <?php
    $page 
    $_SERVER['argv'][0];
    if (!
    file_exists($page.".htm")){
     
    //check to make sure the file exists
     
    $page "main";
     
    //include this page by default
    }
    if (
    strstr($page".")){ 
     
    //hack attempt
     
    $page "main";
    }
    require_once(
    $page.".htm");
    //hard code extension to prevent getting hacked
    //http://mysite.com/?lol will include lol.htm
    ?>
    I've messaged you on skype if you need further assistance.
     
    • Thanks Thanks x 1
    Last edited: Jan 17, 2012