SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic links convert to seo links

    How can I convert all php links to ceo links. For example with pages.php?c=8 to pages/c/8

    Do I need to in .htaccess file to add every scenario for my url's like ?c=x&d=x&y=x or is it possible as I can assume to convert all php files with ?somevar to seo.
    If anyone is willing to help with concrete example of .htaccess file.

    thanks in advance

  2. #2
    SitePoint Evangelist simshaun's Avatar
    Join Date
    Apr 2008
    Location
    North Carolina
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Generally people do one of two things.

    A. Using htaccess, set up a RewriteRule for each individual script.
    For example, you would set up a rule for pages/8 to pages.php?c=8, a rule for news/2010/03 to news.php?year=2010&month=03, etc.

    B. Using two RewriteCond's and a RewriteRule, set it up so that any non-existing files and folders are passed to a single script (known as a front-controller). The front-controller (a php script) parses the URI and determines which script needs to be loaded.

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

    I'm afraid that you've got it backward: YOU, Mr Webmaster, are responsible for creating the links in the format you require (e.g., pages/c/8) THEN you write mod_rewrite statements to convert them (as suggested by simshawn) to your pages.php script with the query string you need.

    I've outlined this process in my signature's mod_rewrite tutorial. Have a read then, if necessary, come back with questions.

    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 Zealot
    Join Date
    Jun 2006
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for replies, I'll take a look this mod_rewrite tutorial.


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
  •