Lukeidiot Posted December 15, 2010 Share Posted December 15, 2010 I have a layout (heres the code) that includes .php files into the index.php file. <?php // PHP Navigation ----------------------- $go = $_GET['go'];// Gets the ?go $fd = $_GET['fd'];// Gets the ?fd if(empty($go))// If go is empty { $go = 'main.php';// Includes the default page } // Cleaning the gets -------------------- $go = str_replace('http://','',$go); $go = str_replace('www.','',$go); $go = str_replace('.php','',$go); $go = str_replace('.txt','',$go); $fd = str_replace('http://','',$fd); $fd = str_replace('www.','',$fd); $fd = str_replace('.php','',$fd); // End of Cleaning the gets --------------- if(isset($fd) && isset($go) && file_exists($fd."/".$go.".php")){ include ($fd."/".$go.".php"); }else if(isset($go) && file_exists($go.".php")){ include ($go.".php"); }else{ echo "<p><b>Sorry, that page does not exist.</b></p>"; } // End of PHP Navigation ----------------- ?> I am trying to make it where I can navigate through my blog by visiting this url: http://www.lukeidiot.com/blog/29 by actually redirects to this url: http://www.lukeidiot.com/?go=blog&id=29 I was using this for my .htaccess ReWriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php?go=$1 [QSA,L] I was exploding the $_GET['go'] by "/" and using it as such, but it didn't include correctly. I tried for hours but couldn't get it to work. (NOTE MY MOD_REWRITE DOESNT WORK) Thanks !!! Quote Link to comment https://forums.phpfreaks.com/topic/221743-mod_rewrite-multiple-vars-with-php-include-layout/ 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.