User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,603 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,649 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 870 | Replies: 9
Reply
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Question php and mod_rewrite problem

  #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

RewriteEngine on

RewriteRule ^home.php$ index.php

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

RewriteRule ^([A-Za-z0-9-]+)/$ http://www.mysite.com/$1/main.php [R]
RewriteRule ^([A-Za-z0-9-]+)$ http://www.mysite.com/$1/main.php [R]

ErrorDocument 400 /errors/400.php
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php

Options -Indexes

<Files .htaccess>
deny from all
</Files>

RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule /*$ http://www.google.com [L,R]
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 6
Reputation: sujathasrs is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sujathasrs sujathasrs is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

  #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  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 539
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 54
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Posting Pro

Re: php and mod_rewrite problem

  #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  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

  #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  
Join Date: Jun 2007
Posts: 6
Reputation: sujathasrs is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sujathasrs sujathasrs is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

  #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  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

  #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  
Join Date: Sep 2007
Location: Nevada, U.S.A.
Posts: 38
Reputation: HazardTW is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
HazardTW HazardTW is offline Offline
Light Poster

Re: php and mod_rewrite problem

  #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  
Join Date: May 2007
Location: Bucharest, RO
Posts: 67
Reputation: johny_d is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
johny_d's Avatar
johny_d johny_d is offline Offline
Junior Poster in Training

Re: php and mod_rewrite problem

  #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  
Join Date: Sep 2007
Posts: 13
Reputation: trs21219 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
trs21219 trs21219 is offline Offline
Newbie Poster

Re: php and mod_rewrite problem

  #9  
Sep 28th, 2007
i think thats what im gonna have to do. i just liked the way the other one looked..lol
Reply With Quote  
Join Date: May 2007
Location: Bucharest, RO
Posts: 67
Reputation: johny_d is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 4
johny_d's Avatar
johny_d johny_d is offline Offline
Junior Poster in Training

Re: php and mod_rewrite problem

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:20 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC