help me please i need a magic word / function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • wandaring

    help me please i need a magic word / function

    here's my problem

    If a visitor comes to visit my site and puts in his / her browser www .
    mysite.com/Ceciliasfirstpa ge.html (excluding the space) I want
    Ceciliasfirstpa ge.html to be generated on the fly from a common php page
    generator.

    What functions would i need?

    Is there a function that would return the string www .
    mysite.com/Ceciliasfirstpa ge.html so that I can clear the string and get
    "Ceciliasfirstp age" and use that to generate the temporary file
    Ceciliasfirstpa ge.html with information from my database? I'm imagining it
    would be a predefined variable?

    I also have the idea that i should use .htaccess to redirect the 404 error
    to another file like pagegenerator.h tml which would have the script to make
    the temporary Ceciliasfirstpa ge.html file, but that would mean that the
    requested information http: // www. mysite.com / Ceciliasfirstpa ge.html
    would pass through the .htaccess first then the pagegenerator.h tml and then
    Ceciliasfirstpa ge.html. If this is so, will the string variable be passed?

    Can anyone help me? is there a better way to do this?
    Thanks


  • Rico Huijbers

    #2
    Re: help me please i need a magic word / function

    wandaring wrote:
    [color=blue]
    > here's my problem
    >
    > If a visitor comes to visit my site and puts in his / her browser www .
    > mysite.com/Ceciliasfirstpa ge.html (excluding the space) I want
    > Ceciliasfirstpa ge.html to be generated on the fly from a common php page
    > generator.
    >
    > What functions would i need?
    >
    > Is there a function that would return the string www .
    > mysite.com/Ceciliasfirstpa ge.html so that I can clear the string and get
    > "Ceciliasfirstp age" and use that to generate the temporary file
    > Ceciliasfirstpa ge.html with information from my database? I'm imagining it
    > would be a predefined variable?
    >
    > I also have the idea that i should use .htaccess to redirect the 404 error
    > to another file like pagegenerator.h tml which would have the script to make
    > the temporary Ceciliasfirstpa ge.html file, but that would mean that the
    > requested information http: // www. mysite.com / Ceciliasfirstpa ge.html
    > would pass through the .htaccess first then the pagegenerator.h tml and then
    > Ceciliasfirstpa ge.html. If this is so, will the string variable be passed?
    >
    > Can anyone help me? is there a better way to do this?
    > Thanks[/color]

    Is there a good reason you don't want people visiting your PHP file
    directly? It might be you're confused about the purpose of PHP. PHP is
    designed to do what you want, namely generating webpages on-the-fly, and
    sending them to the browser. There's no need for an intermediary
    temporary file.

    If you're just trying to hide that there's a PHP script behind the page,
    you might consider using the .htaccess file to direct Apache to run
    regular .html files through the PHP processor as well. Then you can just
    put your script in the .html file, and it will generate the page
    normally, but people from the outside won't be able to see it's a PHP
    script.

    Well, not at first glance anyway ;)

    -Rico

    Comment

    • Christian Fersch

      #3
      Re: help me please i need a magic word / function

      wandaring wrote:[color=blue]
      > If a visitor comes to visit my site and puts in his / her browser www .
      > mysite.com/Ceciliasfirstpa ge.html (excluding the space) I want
      > Ceciliasfirstpa ge.html to be generated on the fly from a common php page
      > generator.
      > [...]
      > Can anyone help me? is there a better way to do this?[/color]

      Yes, there is. Take a look at apache's mod_rewrite. You can change your
      ..htaccess so that, if the user requests "www.mysite .com/pagename.htm",
      apache will give him what he would have become if he had asked for
      "www.mysite .com/yourscript.php? page=pagename". Nice, isn't it? :)

      Greetings, Christian.

      Comment

      Working...