Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 13th, 2007, 01:55 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default link problem with mod_rewrite

Does anybody work with mod_rewrites and could help me understand this, I am new to using these and I have spent alot of time trying to figure this out. Any help is greatly appreciated.

This is my php being pulled from the DB
$strRet .= "[list]";
while ($row = mysql_fetch_array($result)) {
$strRet .= "<li>";
$strRet .= "<a href=\"tableofcontents/{$row['chapterID']}\">{$row['chapterTitle']}</a>";
$strRet .= "</li>";
$strRet .= "</ul>";

I am using this RewriteRule
RewriteRule ^manual/chapters/tableofcontents/?([0-9]+)? manual/chapters/tableofcontents.php?chapter=$1

What I am not understanding is that when I come to the link http://www.mysite.com/manual/chapters/tableofcontents the first time everything works correctly.
Now when I select the link above my page goes to http://www.mysite.com/manual/chapters/tableofcontents/9 everything on the page appears fine,
but now my links change too http://www.mysite.com/manual/chapter...leofcontents/9 then everytime afterwards it keeps adding a tableofcontents/

My question is why would it keep adding that table of contents?

Thanks Mike

Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite stevenpup ASP.NET 2.0 Basics 2 December 22nd, 2007 05:54 PM
mod_rewrite question harpua Pro PHP 0 April 12th, 2007 08:56 PM
Mod_rewrite heerajee Pro PHP 1 March 8th, 2006 06:35 AM
mod_jk + apache + mod_rewrite fanch Apache Tomcat 0 December 5th, 2005 12:34 PM
Apache mod_rewrite() anshul Linux 2 October 14th, 2005 09:09 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.