SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    66
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Deactivate php driven page?

    Hi,

    I have a PHP web site and want to deactivate a php driven page. In other words- I want to remove the page, but only on a tempoary basis.

    How can I do this? Can this be done in the .htaccess file? Thx for your help.

  2. #2
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Are you trying to just stop the page from processing on load? Just place exit() at the top:

    PHP Code:
    exit(); 
    If you'd like to redirect a user to another page first, use header():

    PHP Code:
    header('Location http://www.example.com');
    exit(); 
    That will "deactivate" this page from processing as long as the exit is placed before any code. You can turn it back on by removing this bit of code.
    TAKE A WALK OUTSIDE YOUR MIND.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2008
    Posts
    66
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi - the thing is one file on the server is being used to generate many pages. So if I go in and edit that one file, other pages will be affected also. The pages are dynamically generated from a database. I want to be able to just deactivate the one page, but it does not have its own standalone php file dedicated strictly to it. Thx.

  4. #4
    Visible Ninja bronze trophy
    JeffWalden's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,709
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Right. You could try adding a redirect to the .htaccess file AFTER the URL rewrite rules. Though I'm not an expert there so it may not work as intended. Your redirect would look something like this:

    Code:
    Redirect 301 /page-to-deactivate http://www.example.com
    TAKE A WALK OUTSIDE YOUR MIND.

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Without seeing the code generating the page, there's really not gonna be an answer to this question (a redirect would require a unique URL)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •