TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-15-2008, 03:00 AM   #1 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default mod_rewrite correct?

I am having trouble with mod rewrite. I have looked at some tutorials and one of them stated to look for a module after running the phpinfo() thingy. I didnt have it, but after logging into godaddy (my host) they say all their linux hosting does. So I should. My question is should this work correcty or am I screwing something up. Im still really new at this and reg expressions arent my good buddy yet.

The rewrite should take a page called MoreInfo.php?p=22 into MoreInfo/p/22/

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule MoreInfo/(.*)/(.*)/$ MoreInfo.php?$1=$2
CoryMathews is offline  
Reply With Quote
Old 07-15-2008, 03:32 AM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

That should work, but maybe give this a try?
Code:
Options +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteRule ^moreinfo/([A-Za-z]+)/([0-9]+)/?$ moreinfo.php?$1=$2 [L]
delayedinsanity is offline  
Reply With Quote
The Following User Says Thank You to delayedinsanity For This Useful Post:
CoryMathews (07-16-2008)
Old 07-16-2008, 01:02 AM   #3 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

Hum nope didn't work either must be the host. I will have to give them a call. Thanks delayed.
CoryMathews is offline  
Reply With Quote
Old 07-16-2008, 02:24 AM   #4 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

No problems... are you getting a 500 error when you attempt to add that to your .htaccess, or is it just not redirecting properly?
-m
delayedinsanity is offline  
Reply With Quote
Old 07-16-2008, 02:28 AM   #5 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

I just get a "No input file specified." thats it.
CoryMathews is offline  
Reply With Quote
Old 07-16-2008, 03:31 AM   #6 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Hmmm, you sure that's not an error from your php script? Do you have it online somewhere for us to see?
-m
delayedinsanity is offline  
Reply With Quote
Old 07-16-2008, 03:55 PM   #7 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

No its not online but should be within the next week or 2. But I dont think it has to do with php because the file works perfectly fine on its own.
CoryMathews is offline  
Reply With Quote
Old 07-16-2008, 04:25 PM   #8 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

I was just thinking even if it wasn't online in the going live sense, maybe it was somewhere we could poke and prod at it in the test sense. Generally speaking if you have a rewrite rule in your .htaccess and you're not getting a 500, then mod_rewrite is enabled and working. I was thinking it might be one of those times we're both missing something simple... Is the full URL on your test something like; http://localhost/moreinfo.php?p=22 ?
-m
delayedinsanity is offline  
Reply With Quote
Old 07-16-2008, 04:46 PM   #9 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

What specifically is done to generate the 'no input file generated' error message? Is this an error message that comes from moreinfo.php when an invalid value for p= is specified?
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-16-2008, 07:07 PM   #10 (permalink)
The Acquainted
Upcoming Programmer 
 
CMellor's Avatar
 
Join Date: Sep 2007
Location: Leeds, UK
Posts: 141
Thanks: 6
CMellor is on a distinguished road
Default

Hey, try:

Quote:
RewriteEngine On
RewriteRule ^p/([^/]*)/$ /MoreInfo.php?p=$1 [L]
Maybe add a base tag inside the <head> tag:

Code:
<base href="http://www.yoursite.com" />
and see if that helps. It once helped me.
__________________
Not quite a n00b...
CMellor is offline  
Reply With Quote
Old 07-16-2008, 07:26 PM   #11 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

Quote:
Originally Posted by drewbee View Post
What specifically is done to generate the 'no input file generated' error message? Is this an error message that comes from moreinfo.php when an invalid value for p= is specified?
I go to moreinfo.php/p/11/ and thats what it says. and 11 should be there.

Ill try that out CMellor when i get a chance thanks.
CoryMathews is offline  
Reply With Quote
Old 07-16-2008, 07:29 PM   #12 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

Quote:
Originally Posted by CoryMathews View Post
I go to moreinfo.php/p/11/ and thats what it says. and 11 should be there.

Ill try that out CMellor when i get a chance thanks.
Shouldn't you be going to moreinfo/p/11
typo?

Anyways, what I meant was does moreinfo.php generate that above error if you say go to the url /moreinfo.php?p=283234
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Old 07-16-2008, 11:14 PM   #13 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

ye sorry i meant moreinfo/p/11 even if i use a number with no correct info I get the same No input file specified.

I have created a test page online to help with this. The link is http://www.osguide.net/test/test.php?$p=1

and this link should work
http://www.osguide.net/test/test/p/1/


Here is the .htaccess file

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule /test/test/(.*)/(.*)/$ /test.php?$1=$2
and the php page

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<base href="http://www.osguide.net" />
</head>
<?php
if(is_numeric($_GET['p'])) {
        
$id $_GET['p'];
        echo 
$id;
}
?>
 This was a test.
<body>
</body>
</html>
CoryMathews is offline  
Reply With Quote
Old 07-17-2008, 02:15 AM   #14 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Try adding;

Code:
Options -MultiViews
to the .htacess and see if that fixes it.
-m
delayedinsanity is offline  
Reply With Quote
Old 07-17-2008, 02:17 AM   #15 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

nope as you see now it is just not found all together.
CoryMathews is offline  
Reply With Quote
Old 07-17-2008, 01:26 PM   #16 (permalink)
The Acquainted
 
drewbee's Avatar
 
Join Date: May 2008
Posts: 175
Thanks: 9
drewbee is on a distinguished road
Default

The following should work without a doubt... are you sure mod_rewrite is installed / active?

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule moreinfo/(.*)/(.*)/$ /moreinfo.php?$1=$2
/moreinfo/p/123/
__________________
There are No Stupid Questions. But there a LOT of Inquisitive Idiots.
Send a message via AIM to drewbee
drewbee is offline  
Reply With Quote
Reply



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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:58 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design