Mod_rewrite being difficult

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
What's the ? for anyway?
 
0
Close
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
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back