...

View Full Version : how to use the apache's Mod_Rewrite?



kamkam
07-16-2007, 11:17 AM
Hi;
I am testing for how to use the Apaches's Mod_Rewrite for user submit their new thread like this forum does.

The following are my result from my test.
Not Found
The requested URL /tutorials/13/0.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.



I am hosting at the movement. And i have put the Rewrite rule to the .htaccess file as following;
RewriteRule ^tutorials/(.*)/(.*).php /tutorials.php?req=tutorial&tut_id=$1&page=$2

and in my post.php file, the code as following;


<html>
<body>

<form action="http://www.forum.me.com/tutorials/13/0.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>


But when i click the submit button, it bring out the above result which i have highlighted to me.

1) Could you tell me what i have done wrong?
2) how to set up a new page with some content for the "http://www.forum.me.com//tutprials.php?req=tutorial&tut_id=13&page=0"


Thanks

bazz
07-16-2007, 12:47 PM
I think you should remove the tags to start with?

bazz

rafiki
07-16-2007, 01:24 PM
this isnt PHP can a mod move to General Web Building

kamkam
07-17-2007, 10:19 AM
> I think you should remove the tags to start with?

Hi bazz;
Could you specify out which tags? Thanks

kamkam
07-17-2007, 10:34 AM
>this isnt PHP can a mod move to General Web Building

Hi rafiki;

I don't think so, who write the code for user submit their thread?

matthewlesh
07-17-2007, 11:10 AM
I don't think the problem is related to the php if you are getting a 404 error when it tries to find the page.

Here is what i think should be inside the .htaccess file.



RewriteEngine on
Options +FollowSymlinks

RewriteRule ^tutorials/(.*)/(.*).php tutorials.php?req=tutorial&tut_id=$1&page=$2 [L]


I think that should work... let me know if you still have problems, also make sure the .htaccess file is inside the right directory.

bazz
07-17-2007, 11:16 AM
Hi bazz;
Could you specify out which tags? Thanks

Not sure why they didn;t show up but I emant the [ b] [ / b ] tags in the forst line of the form.

bazz

kamkam
07-18-2007, 09:59 AM
That's ok, bazz. Thanks anyway.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum