Jump to content

Page includes


Schlo_50

Recommended Posts

Hi all,

 

Im currently exploring methods to make a website more seach engine friendly. I read that including pages with PHP with '?' is poor for optimisation and do wondered what my other options might be?

 

I currently use the following to include pages into my index.php file:

 

<?php    
    if(!empty($_GET['id']) && file_exists("./$_GET[id].php")){
include("./$_GET[id].php");
     } else {
include("./main.php");
     }
?>

 

Making my hyperlinks look like this:

<a href="?id=main">Link Here</a>

 

I have seen sites have the following in the address bar but am not sure how to achieve it? http://www.somesite.co.uk/some-page

 

Also, is there any better character to use other than '?' ?

 

Sorry for all the questions but I'd like to know what others are doing,

Thans in advance!

Link to comment
https://forums.phpfreaks.com/topic/132115-page-includes/
Share on other sites

Yes, when implemented correctly mod_rewrite is way more SEO friendly, mainly because you can disguise the urls to look like actual pages and not have to use the ? and the = and the & which most search engines do not like.

 

Instead of :

 

http://www.yoursite.com/page.php?h=1&b=2 

 

it is

 

http://www.yoursite.com/page/h/1/b/2.html

 

The .html is not necessary but yea. Using the modrewrite you can parse that data out of there and have a clean looking url.

 

As suggested google has a bunch of tutorials on this and it is fairly easy to implement.

Link to comment
https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-686765
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.