xbl1 Posted July 16, 2007 Share Posted July 16, 2007 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 FoundThe 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=$2and 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 Link to comment Share on other sites More sharing options...
Anders Moen Posted July 18, 2007 Share Posted July 18, 2007 Have you writtenRewriteEngine onin the top of the .htaccess?And one more thing: I don't think you can rewite to .php. Try with .htm or .html instead: RewriteEngine onRewriteRule ^tutorials/(.*)/(.*).htm /tutorials.php?req=tutorial&tut_id=$1&page=$2 and then of course change http://www.forum.me.com/tutorials/13/0.php with http://www.forum.me.com/tutorials/13/0.htmI tried to rewrite and still have .php but it wouldn't work for me then...so I tried with .htm and .html and it worked Link to comment Share on other sites More sharing options...
jhecht Posted July 19, 2007 Share Posted July 19, 2007 As Anderson pointed out, putting Rewrite Engine on may do the trick, but just a pointer, don't allow any characters in the rewrite. IF you know that those are going to be integers, then put this: RewriteEngine onRewriteRule ^tutorials/([0-9]+)/([0-9]+)\.php ./tutorials.php?req=tutorial&tut_id=$1&page=$2 Additionally, i believe the error may be because you didn't escape the . in .php, otherwise the regex parser is going to get VERY, VERY confused. Try that out and see what happens. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.