Loans - Dedicated Servers - Mobile Phones - Homeowner Loan - Loans

PDA

View Full Version : Serving Different Content (Cloaking?) .htaccess


stuey
Jul 9th 2006, 5:41 am
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 9th 2006, 6:50 am
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

Edynas
Jul 9th 2006, 6:54 am
Maybe a stupid question but why not make a subdir for testing and when it works move it over to the main part?

stuey
Jul 9th 2006, 7:24 am
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