what kind of site are you trying to make?

some sites you can do in just a few pages, some you will need a few more pages, which is where you rewrite mod comes into play to clean up the urls for SEO

Google doesn't really score any higher for clean urls, it is just for the user, when they see your web url in amongst the other results in google they will see a clean legible url and not just numbers such as "/index.php?productid=124344" instead in google they will see "/index.php/samsunglaptop-model-nc10" which is what you are trying to achieve?

and it is also helpful as some users who type into their urls such as the word NC10 your site will popup in their previous history....

i

    My site will have in excess of about 60 pages, the content of the site is informational non profit only but I want the users to have a good experience while surfing the pages etc.

    To keep things clean I would prefer to have an index that requests the content pages because presently I also use the $page variable in some if statements

      Okay I have an idea!

      Is it possible for me to do this:

      index.php:

      <html>
      <head>
      some title tags
      some meta tags etc etc
      </head>
      <body>
      
      <?php print $page; ?>
      
      
      <!-- FOOTER CONTENT -->
      </body>
      </html>
      
      

      Im not sure how to write it but have an array or switch to populate the variable $page above. The other stuff like title, description and .js and .css I could put in an array as already suggested.

      Your thoughts and code guidance if any?

        Yes, sure you can do that

        From earlier posts it seemed you were already putting everything via index.php, so I thought you were nearly there and adapting it would not be too hard. Hard to tell how experienced someone is!

          cretaceous;11002357 wrote:

          Yes, sure you can do that

          From earlier posts it seemed you were already putting everything via index.php, so I thought you were nearly there and adapting it would not be too hard. Hard to tell how experienced someone is!

          Hi,

          In fairness im not experienced at all, I am really at the early stages of learning PHP, I know variables, simple IF statements, simple associative arrays and of course fluent in HTML.

          I engaged on this project to help me learn PHP quicker and build something functional along the way.

          I have absolutely no problem trying to have the site structured like my last post if I have a sure clear way of know how to make friendly or extensionless URLs.

          When it comes to creating a friendly URL with one string for example:

          http://www.example.com/index.php?p=about

          I can easily turn that into:

          http://www.example.com/about

          I fall over when I get to trying to rewrite two or even three URL strings....

          Originally this was my first question I think.

          I am probably missing something major here, like my thought process on the content folder structure etc compared to the output/display of the URL.

          I have the basics in my folder structure like:

          /js
          /css
          /images
          /includes
          /content "all of my content pages are in this folder at the moment 😕

          So treat me like a week one newbie if you have to :o

            ah.. I think you need to make sure you are using absolute paths to the files

            this may entail you adding a bit of the path in front of every link to images, css, js, php files etc

            so instead of

            <link rel="stylesheet" href="css/style.css" type="text/css">

            do something like:

            <link rel="stylesheet" href="<?php echo $urlbase; ?>css/style.css" type="text/css">

            you can figure out the absolute path by using $_SERVER['PHP_SELF'] and getting at the component parts of it

              cretaceous;11002359 wrote:

              ah.. I think you need to make sure you are using absolute paths to the files

              this may entail you adding a bit of the path in front of every link to images, css, js, php files etc

              so instead of

              <link rel="stylesheet" href="css/style.css" type="text/css">

              do something like:

              <link rel="stylesheet" href="<?php echo $urlbase; ?>css/style.css" type="text/css">

              you can figure out the absolute path by using $_SERVER['PHP_SELF'] and getting at the component parts of it

              No sorry its not what I mean. I aleady have this in my code:

              <?php $url = 'http://' .$_SERVER['SERVER_NAME'].'/'; ?>

              then

              <link rel="stylesheet" href="<?php echo $url; ?>css/superfish.css" type="text/css" media="screen" />

                ok.. which bit is it you are having problems with?

                  cretaceous;11002361 wrote:

                  ok.. which bit is it you are having problems with?

                  okay lets say everything works on my site. All the includes and the content renders correctly.

                  I explained to a friend that I wanted to pull my many content files in different folders to keep everything organised. I told him I had mod_rewrite implemented and asked my best approach.

                  He said to me that if I put content files in different folders then I would need and index.php in each folder as well, each of them request the respective file from within that folder.

                  I asked is that how I achieve a friendly URL like http://www.example.com/about/profiles

                  He said yes but I cant get this method to work.

                  I seem to be going round in circles. I hope you understand what im trying to say?

                    Do you use any database where you pull content from?

                    If you ignore the the benefit by have your design in a header and a footer. Could you have realized your site in pure html witout php?

                    Edit: I dont mean you should, but its a hypothetical question if it is possible.

                      gammaster;11002364 wrote:

                      Do you use any database where you pull content from?

                      If you ignore the the benefit by have your design in a header and a footer. Could you have realized your site in pure html witout php?

                      I dont use a database presently. It would be impossible to create this website in pure HTML.

                      There could be over 60 content pages, comprising of a blog, newsletter and registration in the future. It would be suicide to create a site so large without some server-side content.

                      For example, say I have to change some links site wide, instead of making one adjustment in a config file I would have to goto into every single page to make that change.

                      I have built sites in pure HTML and CSS for years in the past and feel pretty fluent in it. So now for me its time to learn PHP and thats what im doing now 🙂

                        Just follow one set of advice and you will make headway - don't mix and match approachs, until you know what you are doing - none of us can know what else you are trying and it will be guesswork for us.

                          It would be suicide to create a site so large without some server-side content.

                          I totally agree, but as I said it wasnt my intension to make you do that. 🙂

                          To make clean urls is ok, but in my opinion you are about to make a design I personally find odd. In my eyes u create a "problem" with bad structure so you thereafter can fix it with a rewrite rule.

                          www.mydomain.com/about.php shoul be as clean as it could be, an spesially if you have a file with that name. In addition to that you only have static content.

                          If you later on creates a forum or something where you have dynamic content that needs get variables then make a .htaccess file and write your ruules for the forum if you want "clean" urls, but dont mess up things that have no need to IMO...

                          Rewrite urls is great, but only if you need it. You say several times that you feel hitting a wall and things like that, but thats no need to feel like that 🙂

                          I just argue for what I see as a no problem 🙂

                            Guys,

                            I wish to thank you for your input. It is evident at this stage that I do not have a clue about my approach. I think its probably best that we put this thread to bed and I go away and do some research and more PHP studying.

                            If you have any good resources that you think may help me then I will be very grateful

                            Thanks

                              Write a Reply...