php and mod_rewrite problem

Reply

Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

php and mod_rewrite problem

 
0
  #1
Sep 27th, 2007
i have my url structure rewrite from index.php?act=games&task=play to mysite.com/games/play.php but when i try to add a $_GET value to the end of the url it doesnt work.

i want when a user clicks a game for it to be like mysite.com/games/play.php?game=534. but when i call the $_GET['game'] it does not get it??? it just acts like game= nothing

could someone shed some light on this for me?

my .htaccess file

  1. RewriteEngine on
  2.  
  3. RewriteRule ^home.php$ index.php
  4.  
  5. RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+).php$ index.php?act=$1&task=$2
  6.  
  7. RewriteRule ^([A-Za-z0-9-]+)/$ http://www.mysite.com/$1/main.php [R]
  8. RewriteRule ^([A-Za-z0-9-]+)$ http://www.mysite.com/$1/main.php [R]
  9.  
  10. ErrorDocument 400 /errors/400.php
  11. ErrorDocument 401 /errors/401.php
  12. ErrorDocument 403 /errors/403.php
  13. ErrorDocument 404 /errors/404.php
  14. ErrorDocument 500 /errors/500.php
  15.  
  16. Options -Indexes
  17.  
  18. <Files .htaccess>
  19. deny from all
  20. </Files>
  21.  
  22. RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
  23. RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
  24. RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
  25. RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
  26. RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
  27. RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
  28. RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
  29. RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
  30. RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
  31. RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
  32. RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
  33. RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
  34. RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
  35. RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
  36. RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
  37. RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
  38. RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
  39. RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
  40. RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
  41. RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
  42. RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
  43. RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
  44. RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
  45. RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
  46. RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
  47. RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
  48. RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
  49. RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
  50. RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
  51. RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
  52. RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
  53. RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
  54. RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
  55. RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
  56. RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
  57. RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
  58. RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
  59. RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
  60. RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
  61. RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
  62. RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
  63. RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
  64. RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
  65. RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
  66. RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
  67. RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
  68. RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
  69. RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
  70. RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
  71. RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
  72. RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
  73. RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
  74. RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
  75. RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
  76. RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
  77. RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
  78. RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
  79. RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
  80. RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
  81. RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
  82. RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
  83. RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
  84. RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
  85. RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
  86. RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
  87. RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
  88. RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
  89. RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
  90. RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
  91. RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
  92. RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
  93. RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
  94. RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
  95. RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
  96. RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
  97. RewriteCond %{HTTP_USER_AGENT} ^Zeus
  98. RewriteRule /*$ http://www.google.com [L,R]
  99.  
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 6
Reputation: sujathasrs is an unknown quantity at this point 
Solved Threads: 0
sujathasrs sujathasrs is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

 
0
  #2
Sep 27th, 2007
Hi,

In php to send values from one page to another page there are 4 ways

one is submitting a form using get,post
second is using sessions
third is using coockies
fourth one the using anchor tag.

in <a> tag if u want to post a $_GET[''] data need to give echo statement.

ex:- index.php?id = echo $_GET['textbox name (or) the table column name'];

it will gives the id value.

in index.php by using REQUEST['textbox name']; u can get the value.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: php and mod_rewrite problem

 
0
  #3
Sep 27th, 2007
why do you need the .htaccess file. i don't need one and i have done the samething displaying games with an game id. it here: www.vcgames.net
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

 
0
  #4
Sep 27th, 2007
Originally Posted by sujathasrs View Post
Hi,

In php to send values from one page to another page there are 4 ways

one is submitting a form using get,post
second is using sessions
third is using coockies
fourth one the using anchor tag.

in <a> tag if u want to post a $_GET[''] data need to give echo statement.

ex:- index.php?id = echo $_GET['textbox name (or) the table column name'];

it will gives the id value.

in index.php by using REQUEST['textbox name']; u can get the value.
yeah...i know how to pass the values in php but im having a problem with mod_rewrite and passing values....thanks anyways
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 6
Reputation: sujathasrs is an unknown quantity at this point 
Solved Threads: 0
sujathasrs sujathasrs is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

 
0
  #5
Sep 28th, 2007
Sorry,

I con't understand what's ur problem. I think u r using perl or something. I know core php. using html and javascript. But one thing, u get the error id's like 401,402..... So u can post that id's to this site. http://bugs.php.net/. just give that id and submit. It will may explain about ur bug. U may get the solution.


Thanks,
Sujatha
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

 
0
  #6
Sep 28th, 2007
im not using perl im using straight php and html.

my problem is that i want my site to rewrite this( mysite.com?act=games&task=play) to this (mysite.com/games/play.php) which i have done.

then when the user selects a game it will just add the ?game= to the end of mysite.com/games/play.php.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 54
Reputation: HazardTW is an unknown quantity at this point 
Solved Threads: 2
HazardTW HazardTW is offline Offline
Junior Poster in Training

Re: php and mod_rewrite problem

 
0
  #7
Sep 28th, 2007
Whatever link a user uses to go to "mysite.com?act=games&task=play" why not just have that link point to "mysite.com/games/play.php?game=###"
Seems like you might be unnecessarily complicating a simple task.
I mean, why even call mysite.com when that is not the page you are looking for.
Can you show us your code?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 68
Reputation: johny_d is an unknown quantity at this point 
Solved Threads: 4
johny_d's Avatar
johny_d johny_d is offline Offline
Junior Poster in Training

Re: php and mod_rewrite problem

 
0
  #8
Sep 28th, 2007
If you use mod_rewrite, why don't you use it all the way???

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9]+)/$ index.php?act=$1&task=$2&game=$3

or

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([0-9]+).html$ index.php?act=$1&task=$2&game=$3

That would be:
mysite.com/games/play/534/
or
mysite.com/games/play/534.html

or whatever other variation of that you want
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

 
0
  #9
Sep 29th, 2007
i think thats what im gonna have to do. i just liked the way the other one looked..lol
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 68
Reputation: johny_d is an unknown quantity at this point 
Solved Threads: 4
johny_d's Avatar
johny_d johny_d is offline Offline
Junior Poster in Training

Re: php and mod_rewrite problem

 
0
  #10
Sep 29th, 2007
Well I think it kind of make no sense of using both methods in the same url:
if you like query strings, stick to them - index.php?act=games&task=play&game=534

otherwise, if you like or want to use mod_rewrite, than stick to mod_rewrite - mysite.com/games/play/534.html

Do it the way you want or like, but don't mix them
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC