Serving Different Content (Cloaking?) .htaccess

Discussion in 'Apache' started by stuey, Jul 9, 2006.

  1. #1
    When I work on a new website I usually leave an index page up telling people what's going on, however in this instance I need to use the index.php page as it forms par of my new script (and I can't test without it).

    Can I create a rule in my .htaccess file that shows the index page (index2.php - for arguments sake) to everyone, excluding my IP address.

    To block the world I currently use the following rule;

    <limit GET>
    order deny,allow
    deny from all
    allow from xxx.xx.xx.x
    </limit>

    Which gives me access (when I change the xx's to my IP address) and everyone else no access

    However what I really want to do is this (if such a rule exists)

    <limit GET>
    show1=index.php
    show2=index2.php
    order show1,show2
    When access to homepage
    show1 to all
    show2 to xxx.xx.xx.x (being my IP address)
    </limit>

    Is such a thing possible?

    Thanks in advance
     
    stuey, Jul 9, 2006 IP
  2. stuey

    stuey Peon

    Messages:
    160
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You add this you your .htaccess file

    # IF I'm visiting the site
    RewriteCond %{REMOTE_ADDR} ^xxx\.xx\.xx\.x$ [nc]
    RewriteRule (.*) index2.php [L]


    Regards

    Stuey
     
    stuey, Jul 9, 2006 IP
  3. Edynas

    Edynas Peon

    Messages:
    796
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Maybe a stupid question but why not make a subdir for testing and when it works move it over to the main part?
     
    Edynas, Jul 9, 2006 IP
  4. stuey

    stuey Peon

    Messages:
    160
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Because it involves moving files and changing alot of settings. I would usually have done this.... however with this solution, it takes 5 seconds to add/remove and is now working perfectly.

    Thanks for pointing out the obvious though, I'm sure people at times would miss that.

    Regards

    Stuey
     
    stuey, Jul 9, 2006 IP