python - Simple mod_rewrite example -
i trying write simple mod_rewrite rule, , have no clue why it's not working.
i want rewrite http://example.com/to/abc
http://example.com/to/index.py?to=abc
.
currently, rewrite rule is:
rewriteengine on rewriterule ^/?to/(.*)$ /to/index.py?to=$1
which, knowledge, should match url similar /to/whatever
, or without leading /
.
can tell me i'm missing here?
for starters, haven't mentioned in way, exactly, it's "not working". if had guess, it's looping, , need instead:
rewriteengine on rewritecond %{request_uri} !index.py rewriterule ^/?to/(.*)$ /to/index.py?to=$1 [pt]
that says "don't rewrite if it's been rewritten.
the [pt] on there says "treat target uri, rather file path.
however, in order certain, you'll need tell what's happening, , in way differs want happening. error log entries helpful. rewrite log entries more helpful.
Comments
Post a Comment