Web Analytics Made Easy -
StatCounter Search Engine friendly URL in HTML With PHP - CodingForum

Announcement

Collapse
No announcement yet.

Search Engine friendly URL in HTML With PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search Engine friendly URL in HTML With PHP

    Hi Everyone

    I need some help about how to enhance PHP to generate HTML page.

    I have one example, which is done by someone else, this is like he did as below:-

    Actual URL generated by PHP is as below:-
    http://www.w5d.de/index.php?c=2

    But by this developer, it is converted to in this html format
    http://www.w5d.de/c,2.html

    Can any one give me idea what to do, to make these html pages throuh PHP

    Mohnesh Kohli
    http://www.megrisoft.com http://www.indiabook.com
    http://www.idofind.com http://www.submitshop.com
    Submit Shop Search Engine Optimization
    Last edited by Jagan; Feb 12, 2004, 09:36 AM.
    Jagan Nath
    Web Development Company India SEO Services Since 1998 - Custom PHP Web Development

  • #2
    This has nothing to do with PHP.
    That's a module for apache.

    --> mod_rewrite
    You can define RewriteRules to 'rewrite' and redirect to another page/request string without redirecting by header.

    --> http://httpd.apache.org/docs-2.1/en/...d_rewrite.html
    --> http://www.sitepoint.com/article/910/1
    --> http://razertech.com/edge/web/modrewrite-1.htm
    www.united-scripts.com
    www.codebattles.org

    Comment


    • #3
      I wouldn't have your 'signature' as that long again either, your sig is almost as big as your post, if not bigger

      Comment


      • #4
        I have two question

        a) Can i do the this all through .httaccess file, if yes then what to write in the file

        b) Because i have no server access, so i can not make any changes in apache, can you let me know what i have to write my server people to make the things working.

        Jagan
        Jagan Nath
        Web Development Company India SEO Services Since 1998 - Custom PHP Web Development

        Comment


        • #5
          a) yes - see links below
          Edit: ehh... above i mean...


          b) following: "Hi guys, is it possible to use mod_rewrite by htaccess files? If not, is it possible to switch it on? Thx very much. Regards, Jagan".
          Last edited by piz; Feb 12, 2004, 12:55 PM.
          www.united-scripts.com
          www.codebattles.org

          Comment


          • #6
            http://www.sitepoint.com/article/910

            Comment


            • #7
              mod_rewrite is only 1 way to skin the cat and very complex for the regex challenged

              Apache has a 'lookback' feature which means that when you type in say

              www. domain.com/blah/fnar

              apache will ( with force-type directive set in .htaccess ) look for fnar.html or fnar.php [depending on the force-type statement] , in the /blah/ directory if it exists..

              if the /blah/ directory does not exist apache will look for blah.php etc and if that exists add 'fnar' to the $_SERVER['PATH_INFO'] array .

              which brings us to $_SERVER['PATH_INFO'] ..
              with the url www .domain.com/index/blah/fnar/grug (or indeed www .domain.com/index.php/blah/fnar/grug )

              if say index.php exists then then blah,fnar and grug will all be available via $_SERVER['PATH_INFO'].

              The only downside to using PATH_INFO is that those url's mess up any relative links you may have on the page , so you need to use absolute links or add a prefix to your relative links depending on the depth of the PATH_INFO.

              Using PATH_INFO also requires that you know the exact order of the incoming variables as variable names are not passed only thier values.

              Thats why you often see other characters passed which are used as a delimiter e.g. with www. domain.com/index.htm/3,5,blue,fnah may well be 4 comma delimited variables , its easier to pass (and parse!)

              domain.com/index.htm/3,,,fnah
              than
              domain.com/index.htm/3//fnah

              again though your script needs to know the exact order of incoming data, but this is preferable (IMO) to multiple mod_rewrite rules.

              Another common method employed is by using Apache's error handling , you can make your 404 error page a php (or other) script , which will read the url than caused the 404 , parse it and set a header to the actual page preserving the original url.

              I personally prefer one of the the PATH_INFO methods as it works on almost all PHP installations (on IIS you just have to live with the /index.php/fnar/grout
              resistance is...

              MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

              Comment

              Working...
              X