FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » .htaccess vs PHP header(location:)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: .htaccess vs PHP header(location:) [message #175605 is a reply to message #175602] Tue, 11 October 2011 03:33 Go to previous messageGo to previous message
Michael Joel is currently offline  Michael Joel
Messages: 42
Registered: October 2011
Karma:
Member
On Mon, 10 Oct 2011 23:08:03 -0400, Jerry Stuckle
<jstucklex(at)attglobal(dot)net> wrote:

> On 10/10/2011 10:40 PM, Michael Joel wrote:
>> I am wanting to control access to my site.
>> Sometimes I want the site "off" with visitors redirected to a folder.
>>
>> I have been using htaccess but have written a php script to automate
>> the site's on/off control. I am considering using php at the top of
>> each page instead of htaccess.
>>
>> basic outline:
>> my script creates a file when the site is to close. It contains the
>> reason for closing (text), close time (timestamp), and re-open time
>> (timestamp). (...I could also have the script create an htaccess file
>> if that is decided to be best...)
>>
>> My thought is to, instead of use htaccess for the redirect, simple
>> place a PHP file_exists() check at top of every page on the site
>> (scripts as well). If the file exists then header (location:
>> xxxxxxxxx) is used to force a redirect.
>>
>> The advantage to this is:
>> 1) I had help making the htaccess file - I haven't a clue what all the
>> jibberish means. So changing the access to allow certain areas open or
>> not is not easy. I would like to find a simple PDF doc that would give
>> simple explanations on it.
>>
>> 2) it would allow a lot of control on what to close. I simple don't
>> include the check on pages/scripts I want to remain "open".
>>
>> I did wonder if the file_exists check would cause a large slow down on
>> serving pages?
>>
>> Thanks
>> Mike
>
> No, it shouldn't require a lot of overhead to check to see if a file
> exists. Such an option should work fine, as long as you remember to
> include it every time.
>
> However - if you're going to be doing web work, you need to learn some
> basic things like coding some simple things in .htaccess to be
> effective. So I would also recommend you spend a little time learning
> that. It's not too hard once you get the hang of it.

Thank you for your reply.
I have apache's docs that have a few topics on it but so far it is
quite confusing. I have looked at the file and can make out what it is
doing (basically) but I don't get the punctuation marks and how they
are effecting it.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/site_closed.*
RewriteRule ^(.*)$ http://www.parksandsonspiano.com/site_closed/ [R,L]

I get the basic idea but all the marks I am lost on. I guess I will
try to reread the doc again when I am not so tired.

Thanks again for the help
Mike
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Test race condition? (unit test?)
Next Topic: including CSS & JS on only pages that need that CSS & JS
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 07:20:17 GMT 2024

Total time taken to generate the page: 0.05846 seconds