Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Cat
    Cat is offline
    Junior Member Cat's Avatar
    Join Date
    Jul 2006
    Location
    Finland
    Posts
    20
    Member #
    13537
    I know I'll need to use mod_rewrite and I've read a lot of tutorials, but they all teach how to change a page like: site.com/page.php=93je0k to site.com/page.html or something. But I simply want to get rid of the .php extension. Like if I have site.com/page.php would be site.com/page/. Also what code do I need if have a folder, i.e. site.com/folder/file/? Thanks!

    Sorry, if this is wrong forum, I didn't know where to post this thread, this is not a php question.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    I don't think there's a way to do that.

    The closest thing would be to use folders with "index.php" files.


  4. #3
    Cat
    Cat is offline
    Junior Member Cat's Avatar
    Join Date
    Jul 2006
    Location
    Finland
    Posts
    20
    Member #
    13537
    It is! I've seen many websites using it.

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,693
    Member #
    5580
    Liked
    717 times
    Well, technically you could do it, if you didn't have a directory with
    the same name as the file (that doesn't have the extension).

    But, try this:

    create a file with PHP scripting in it, and name it "test" (with no extension).

    It won't be parsed as a PHP script without the extension.

    I guess you could ask your webhost to parse ALL files as PHP, that might work.


  6. #5
    Senior Member -chris-'s Avatar
    Join Date
    Apr 2006
    Location
    SK
    Posts
    1,205
    Member #
    13102
    Quote Originally Posted by mlseim
    The closest thing would be to use folders with "index.php" files.
    That would be the way to do it. Just create a different directory for each page, and put each page in their directories, all with the name index.php. That way, when someone typed www.site.com/whatever/ it would display the index page for that directory.
    Portfolio | Blog | Twitter

    Was my post, or someone elses, helpful? Click the thumbs up to let everyone know!

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Have a look at MediaWiki's implementation. You can use mod_rewrite to send all requests that look like `index.php/folder/place/thing' to the index.php file as simple $_GET variables. Also worth looking into is Rails, which always does URIs this way. J2EE and (I think) ASP.NET also use this method regularly. MediaWiki's implementation also includes a way to get rid of the `index.php' entirely -- as evidenced by the way wikipedia works (wikipedia is powered by MediaWiki).


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:54 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com