SitePoint Sponsor

User Tag List

Results 1 to 25 of 25

Thread: How does ...

  1. #1
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How does ...

    I've heard Google uses PHP, so my question is...

    How do they not show the .php extension on their pages?

    ( http://www.google.com/preferences?q=...UTF-8&oe=UTF-8 )

    i've seen it on other sites as well.

    preferences would be the page, how do they get it to parse without an extension?

  2. #2
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set the files [extensions] that are parsed by the php engine in .htaccess and http.conf (apache), and in the control panel for IIS. Other http servers should work in much the same way.

    Matt.

  3. #3
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea i knew that, but my question is, what extension would you set in order to parse a file without an extension ? *confused*

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aspen has alot to say about it in his article.
    Aaron Brazell
    Technosailor



  5. #5
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you'd put the file name. Sitepoint uses the same methods for the article. It uses ForceType
    Aaron Brazell
    Technosailor



  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming you're using Apache, put the following in a .htaccess file and change 'filename' to the name of your file you want to be passed as a PHP file:

    <Files filename>
    ForceType application/x-httpd-php
    </Files>
    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So you'd have to do that for each and every PHP file that would be accessed? grrr.

  8. #8
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dooby, did you read the article?
    Aaron Brazell
    Technosailor



  9. #9
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sketch
    Dooby, did you read the article?
    Yes I did. I'm not looking to use something to the effect of

    http://www.blahblah.com/blah.php/23432/3243/

    or

    http://www.blahblah.com/signup/step1/

    I was looking to use

    http://www.blahblah.com/signup?page=step1

    In that case, wouldn't i have to add 'signup' to ForceType , as well as every other page I wanted to use without the .php extension?

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One thing you can do is create a folder with the name you want and put an index.php file in it. Then you can call that like this:

    www.domain.com/folder/?something=something

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    o_O O_o BlueFire2k5's Avatar
    Join Date
    Mar 2003
    Location
    Sioux Falls, SD
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DoobyWho
    Yes I did. I'm not looking to use something to the effect of

    http://www.blahblah.com/blah.php/23432/3243/

    or

    http://www.blahblah.com/signup/step1/

    I was looking to use

    http://www.blahblah.com/signup?page=step1

    In that case, wouldn't i have to add 'signup' to ForceType , as well as every other page I wanted to use without the .php extension?
    Yes, you can do the force type for that and you wouldn't have to use the 'virtual folders' way.

    Ex. my site
    http://www.max-evolution.com/news?id=1

    "Sa souvraya niende misain ye."
    - Robert Jordan, The Wheel of Time

  12. #12
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Google uses PHP? are you sure about that?

    anyway, if you don't want to show an extension, you don't need to do anything with Apache. you can keep the file on the server named file.php. however, instead of accessing it as

    /file.php?foo=bar

    use

    /file?foo=bar

    Apache will find file.php as long as there's no other file.diffext in the directory (i guess certain files have priority, but not sure how that's controlled).
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  13. #13
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doesn't seem to work here... get 404 error, (Apache 2.0.44)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  14. #14
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Aaron Brazell
    Technosailor



  15. #15
    o_O O_o BlueFire2k5's Avatar
    Join Date
    Mar 2003
    Location
    Sioux Falls, SD
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DR_LaRRY_PEpPeR
    Google uses PHP? are you sure about that?

    anyway, if you don't want to show an extension, you don't need to do anything with Apache. you can keep the file on the server named file.php. however, instead of accessing it as

    /file.php?foo=bar

    use

    /file?foo=bar

    Apache will find file.php as long as there's no other file.diffext in the directory (i guess certain files have priority, but not sure how that's controlled).
    Yeah, that doesn't work on my server...

    http://www.max-evolution.com/register

    http://www.max-evolution.com/register.php

    Edit:

    Ahh, beat me Sketch.
    Last edited by BlueFire2k5; Mar 26, 2003 at 22:34.
    "Sa souvraya niende misain ye."
    - Robert Jordan, The Wheel of Time

  16. #16
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you're not putting a / at the end of the name are you and making it look for a directory? it works fine here on everything with 1.3.27 (basically default Win2k install). BTW, did notice that when there's index.html and index.php in the directory, and you go to /index, it uses index.html.

    i wonder if this feature is controlled by a config setting? can't think of anything off hand (unless it's a new config thing in Apache 2). i'll see if i can find out later...


    oh, and Sketch/everyone, this is a tip on the w3c site (files w/o extensions), and it says Apache is supposed to work how i described. i'll see if i can find the link.

  17. #17
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dang, i can't find that w3c page now (i think that's where it was). it was a Tip of the Day link once after using the Validator. it was written by Tim Burners Lee i think.

    the "trick" doesn't work on my host's server (VenturesOnline), but it does work on these forums: www.sitepointforums.com/forumdisplay?forumid=34


  18. #18
    o_O O_o BlueFire2k5's Avatar
    Join Date
    Mar 2003
    Location
    Sioux Falls, SD
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DR_LaRRY_PEpPeR
    dang, i can't find that w3c page now (i think that's where it was). it was a Tip of the Day link once after using the Validator. it was written by Tim Burners Lee i think.

    the "trick" doesn't work on my host's server (VenturesOnline), but it does work on these forums: http://www.sitepointforums.com/forumdisplay?forumid=34

    Kind of, it displays the index file...
    "Sa souvraya niende misain ye."
    - Robert Jordan, The Wheel of Time

  19. #19
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OMG, i'm so retarded. i didn't even see what the page was. so maybe that's the custom 404 error page here...

  20. #20
    o_O O_o BlueFire2k5's Avatar
    Join Date
    Mar 2003
    Location
    Sioux Falls, SD
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DR_LaRRY_PEpPeR
    OMG, i'm so retarded. i didn't even see what the page was. so maybe that's the custom 404 error page here...
    Sure is.

    http://www.sitepointforums.com/bahbah

    "Sa souvraya niende misain ye."
    - Robert Jordan, The Wheel of Time

  21. #21
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep.

    well, i figured out why it works on mine: i have the MultiViews Option enabled. e.g. in httpd.conf

    Options All MultiViews

    so instead of ForceType, you could turn on MultiViews in .htaccess if you don't have access to httpd.conf:

    Options +MultiViews

    http://httpd.apache.org/docs/mod/core.html#options
    http://httpd.apache.org/docs/content-negotiation.html

  22. #22
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a setting in httpd.conf, um, what is it... multiviews or something like that I think.
    Oh no! the coots are eating my nodes!

  23. #23
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Damn you doctor beating me to it before I could put you all to shame!
    Oh no! the coots are eating my nodes!

  24. #24
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DR_LaRRY_PEpPeR
    Google uses PHP? are you sure about that?
    They use PHP for certain parts of their site, not for anything search related

    http://www.sitepointforums.com/showt...ghlight=google

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  25. #25
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there any security risks for using MultiViews on rather then ForceType?


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
  •