Ne.OnZ Posted May 4, 2008 Share Posted May 4, 2008 I started this discussion elsewhere, but it turned into something else. So, I'll ask the question I asked with Haku's quote: f one page's content is www.yoursite.com/index.php?content=main, and another page's content is www.yoursite.com/index.php?content=about_us, then you set up the mod rewrite so that when you access: www.yoursite.com/main it shows the user the content of www.yoursite.com/index.php?content=main, and when you access www.yoursite.com/about_us it shows the user the content of www.yoursite.com/index.php?content=about_us. In this way, search engines will index the pages as entirely separate pages, even though they are actually both contained within index.php How would I go about doing this? I'm so lost ! Thank You. Link to comment https://forums.phpfreaks.com/topic/104035-mod-rewrite/ Share on other sites More sharing options...
dezkit Posted May 4, 2008 Share Posted May 4, 2008 <?php $page = $_GET["page"]; if (!$page) { include "/home.php"; } else if($page=="main") { include "/main.php"; } else if($page=="about_us") { include "/about_us.php"; } else { echo "<b><h1>404 Error</h1></b>"; } ?> Let me break it down for you. include "/home.php"; means that the default home page is home.php so when you type www.website.com/index.php, home.php is the content. else if($page=="main") { include "/main.php"; } means that if the page is index.php?page=main that the content will be included from main.php Link to comment https://forums.phpfreaks.com/topic/104035-mod-rewrite/#findComment-532568 Share on other sites More sharing options...
Ne.OnZ Posted May 4, 2008 Author Share Posted May 4, 2008 See the thing is, I have my pages included inside a div, so the top part of my page is never changed. http://www.divnx.net If you were to go here: http://www.divnx.net/map.php, you will see only the code in map.php not the rest of the page. Link to comment https://forums.phpfreaks.com/topic/104035-mod-rewrite/#findComment-532779 Share on other sites More sharing options...
dezkit Posted May 4, 2008 Share Posted May 4, 2008 Alright dude, do you have AIM? If yes, IM me, bicthplzz14 Link to comment https://forums.phpfreaks.com/topic/104035-mod-rewrite/#findComment-532782 Share on other sites More sharing options...
DarkWater Posted May 4, 2008 Share Posted May 4, 2008 Put this in a .htaccess in the correct directory: <IfModule mod_rewrite.c> RewriteEngine On </IfModule> RewriteRule ^([a-zA-Z0-9]+)$ index.php?content=$1 RewriteRule ^([a-zA-Z0-9]+)/$ index.php?content=$1 It'll take ANY request that has no extension and is just letters and numbers and send it off to the index.php?content= thing. Link to comment https://forums.phpfreaks.com/topic/104035-mod-rewrite/#findComment-532784 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.