Forum Moderators: phranque

Message Too Old, No Replies

Simple one line mod rewrite not working

please have a quick look

         

zeeshan_kh

11:22 am on Nov 24, 2006 (gmt 0)

10+ Year Member



Hey,

I'm trying to create a dynamic sitemap for my site.

RewriteRule ^sitemap/(.*)(/)?$ sitemap.php?show=$1 [R]

this line is supposed to send everything after sitemap/ to sitemap.php in the variable "show" but its actually giving a page not found error when the sitemap.php does exist.

can anyone have a quick look please.

Thanks!

zeeshan_kh

3:03 pm on Nov 24, 2006 (gmt 0)

10+ Year Member



Done!

needed an [L] at the end

RewriteRule ^sitemap/([A-Za-z0-9]+)?/?$ sitemap.php?show=$1 [L]

MattyUK

7:37 pm on Nov 24, 2006 (gmt 0)

10+ Year Member



Hi

A small comment.


RewriteRule ^sitemap/([A-Za-z0-9]+)?/?$ sitemap.php?show=$1 [L]

Wouldn't allow any characters in the return value other than letters and numbers. If this intended then no problem but otherwise you might want to consider.


RewriteRule ^sitemap/([a-z0-9_+-]+)?/?$ sitemap.php?show=$1 [NC,L]

I haven't tested it but its seems to make sense, I'm sure you'll get the gist. Don't allow additional characters unless you need to but so long as they don't sneak up on you. You could also consider spaces but hopefully they won't be required.

Matt

[edited by: MattyUK at 7:37 pm (utc) on Nov. 24, 2006]