Dynadot โ€” .com Transfer

Mod_rewrite being difficult

Spacemail by SpaceshipSpacemail by Spaceship
Watch

erik.hillis

Established Member
Impact
5
This ABSOLUTELY(!!) won't work:
Code:
RewriteEngine On
RewriteRule ^poll/21/? index.php?page=Poll&id=21 [L]
^The page loads with no content, no source, and gives no warning or error messages.

But when I change it to pollx/21/, it magically works?

There is no /poll/ folder... so that is not the problem.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
What's the ? for anyway?
 
0
•••
Is there an earlier rewrite rule for "^poll" ? Perhaps in the apache httpd.conf file, or a higher level .htaccess?

The ? makes the preceeding character optional. i.e. the rule will match either "^poll/21/" or "^poll/21". This may not be exactly what you want, since it will also match any URL beginning with "poll/21" ("poll/212121", "poll/21abc" etc). You might want a "$" after the "?" to match end of line:

Code:
RewriteRule ^poll/21/?$ index.php?page=Poll&id=21 [L]

Eventually I assume you'll do pattern matching and use the match in the rewritten URL.
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back