Schlo_50 Posted November 10, 2008 Share Posted November 10, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/ Share on other sites More sharing options...
JasonLewis Posted November 10, 2008 Share Posted November 10, 2008 What those sites are using is rewriting. Look at the mod_rewrite section of these Forums, or Google it. It's relatively easy to implement. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-686567 Share on other sites More sharing options...
Schlo_50 Posted November 10, 2008 Author Share Posted November 10, 2008 Is mod_rewrite when implement more search engine friendly? Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-686708 Share on other sites More sharing options...
premiso Posted November 10, 2008 Share Posted November 10, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-686765 Share on other sites More sharing options...
Schlo_50 Posted November 12, 2008 Author Share Posted November 12, 2008 Damn..Not sure as if it is enabled on my server.. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-688536 Share on other sites More sharing options...
JasonLewis Posted November 12, 2008 Share Posted November 12, 2008 Contact your host and ask if you can get it enabled. If it's disabled. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-688539 Share on other sites More sharing options...
haku Posted November 12, 2008 Share Posted November 12, 2008 Almost all hosts allow URL re-writing. You just have to set it in the .htaccess file. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-688564 Share on other sites More sharing options...
premiso Posted November 12, 2008 Share Posted November 12, 2008 Easy way to check, create a phpinfo.php with the following: <?php phpinfo(); ?> Open the page and look under "Apache" -> "loaded modules" If mod_rewrite is enabled it will be listed under that. Quote Link to comment https://forums.phpfreaks.com/topic/132115-page-includes/#findComment-688565 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.