SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,786
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    How far to go with "Pretty URLs"?

    My website uses "Pretty URLs" like this...

    http://local.debbie/finance/articles/postage-meters-can-save-you-money


    How far should I take this approach?


    For consistency - or whatever - should I create mod_rewrites for simple URLs like this...

    http://local.debbie/account/my-account.php


    Sincerely,


    Debbie

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,836
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    For purposes of consistency, it would make sense to use SEF URLs on everything, though you don't necessarily need to. That's what I generally do. My rewrite in htaccess sends requests to a file which then uses a switch statement to determine which resource is being requested then loads the appropriate include files. Adding SEF support for another page pretty much is a simple process requiring only an additional entry in the switch statement. The choice is yours whether or not to do it depending on your preferences.

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,656
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Personally, I'd check for existing directory and file before redirecting on "pretty URIs." The other "technique" would be to disallow the dot character (and /'s) in your redirections to eliminate filenames.

    Regards

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,786
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    Personally, I'd check for existing directory and file before redirecting on "pretty URIs." The other "technique" would be to disallow the dot character (and /'s) in your redirections to eliminate filenames.

    Regards

    DK
    I'm not understanding you?!


    In this URL...

    http://local.debbie/account/my-account.php


    I have a script called "my-account.php" in a directory called "account" in my Web Root.


    Debbie

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,656
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    DD,

    Code:
    RewriteCond {REQUEST_FILENAME} -d // checks for the request being a directory
    RewriteCond {REQUEST_FILENAME} -f // checks for the request being a file
    If both fail (in other words, use !-d and !-f to be true AND true), then do your redirection which will NOT affect any directory or file request.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


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
  •