Jump to content


how to debug and see what the rewritter is building?

  • Please log in to reply
2 replies to this topic

#1 mojito

  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 19 June 2006 - 04:30 PM

here is some code in my .htaccess im trying to figure out...
RewriteBase /
RewriteRule ^\.htaccess$ - [F]
RewriteRule listing/(.+) /listing.php?type=$1
RewriteRule faq/(.+).php /roatan-faq.php?catid=$1
RewriteRule photo_album/(.+)/(.+) /spg_view_category.php?category_id=$1
RewriteRule photo/(.+)-(.+)/(.+) /spg_view_image.php?image_id=$1&category_id=$2

I cant work out how from my localhost machine where im testing this stuff it actually links to the real website so somehwhere the domain is getting changed from the root which should be localhost but is not.

Is it the RewriteBase command ? I cant work out

I just figured out that problem there was a <base> tag set in the source. Silly me.

But here is my problem, I cant get it to work on my localhost. I cant debug it, i cant see what the rewritter is creating its not right as it cant find the page, how can i do an echo or print in .htaccess?

Also how can I comment out lines in .htaccess I tried a # but it doesnt seem to work. [edit it does work now]

mojito [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]

#2 mojito

  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 19 June 2006 - 06:25 PM

If I get a url like

[a href=\"http://localhost/cambs.eu/listing/properties.php\" target=\"_blank\"]http://localhost/cambs.eu/listing/properties.php[/a]

then the rule

RewriteRule listing/(.+) /listing.php?type=$1

should give


It doesnt in fact the query string isnt working. What am I doing wrong. Even if i hard code something the query string isnt output.

thanks for help on this.


#3 steelmanronald06

  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 20 June 2006 - 03:08 PM

you need to add a rule code to the end of each rewrite rule. like you have [F] on one of those. most times you can use [R] but that is redirect and not a rewrite. Go to the apache manual and look up rewrite rules to learn more about the different rules you cna use.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users