luke777 Posted May 30, 2007 Author Share Posted May 30, 2007 Just got the error message : "Error" Its a pretty complex game site script and which is probably whats causing the problems.... I tryed placing it in index.php as you suggested instead of game.php but i dont think it makes any difference because afterall game.php is displayed inside index.php if you know what i mean.... Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-264729 Share on other sites More sharing options...
Dragen Posted May 30, 2007 Share Posted May 30, 2007 in your .htaccess file change this: RewriteEngine on RewriteCond %{HTTP_HOST} ^monstergamez.net [NC] RewriteRule ^(.*)$ http://www.monstergamez.net/$1 [L,R=301] RewriteEngine on RewriteRule ^(.*)\.html$ index.php?params=$1 [L] Redirect 301 http://monstergamez.net http://www.monstergamez.net to this: RewriteEngine on RewriteCond %{HTTP_HOST} ^monstergamez.net [NC] RewriteRule ^(.*)$ http://www.monstergamez.net/$1 [L,R=301] #RewriteEngine on #RewriteRule ^(.*)\.html$ index.php?params=$1 [L] Redirect 301 http://monstergamez.net http://www.monstergamez.net then click on a game and see what it says in the url address bar Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-264734 Share on other sites More sharing options...
chrisprse Posted May 30, 2007 Share Posted May 30, 2007 Luke, when you tried my piece of code, before you edited the .htacess file given by Dragen, which game were you on? If you were not on Nightmare House or Bat In Nightmare it would have displayed "Error!". Just checking this first before you move on to other suggestions... Chris. Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-264987 Share on other sites More sharing options...
luke777 Posted May 31, 2007 Author Share Posted May 31, 2007 i tryed Nightmare House & Bat In Nightmare Displayed "error" Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-265899 Share on other sites More sharing options...
luke777 Posted June 7, 2007 Author Share Posted June 7, 2007 Well is there any other way i can do this ?? :S Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-270002 Share on other sites More sharing options...
Dragen Posted June 7, 2007 Share Posted June 7, 2007 try this: <?php $URL = "http://www.monstergamez.net/".$_GET['params'].""; $URL = rtrim($URL, "/") . ".html"; switch($URL) { case 'http://www.monstergamez.net/game/991/Nightmare-House.html': //If this URL is in the browser... echo '<b>Put your ad for the game "Nightmare House" here...</b>'; // ... Display this HTML. break; case 'http://www.monstergamez.net/game/9999398/Bat-In-Nightmare.html': //If this URL is in the browser... echo '<b>Put your ad for the game "Bat In Nightmare" here...</b>'; // ... Display this HTML. break; default: echo 'Error!'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-270038 Share on other sites More sharing options...
luke777 Posted June 7, 2007 Author Share Posted June 7, 2007 Thank you so much dragon your a LEGEND! Luke Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-270049 Share on other sites More sharing options...
Dragen Posted June 7, 2007 Share Posted June 7, 2007 well thanks to chrisprse really, I just made a small change to the code he provided. remember to mark the topic solved! Quote Link to comment https://forums.phpfreaks.com/topic/52819-solved-display-html-code-if-url/page/2/#findComment-270188 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.