Jump to content

how to debug and see what the rewritter is building?


mojito

Recommended Posts

here is some code in my .htaccess im trying to figure out...
[code]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[/code]

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]

thanks
mojito [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]
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

/listings.php?type=properties.php


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.

mojito

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.