Reputation: 1580
I'm having an issue with mod_rewrite that I think might be caused by a global rule in some other config file besides my .htaccess and need to see if there is a way to display all the RewriteRules that are in effect.
Specifically, my issue is http://mydomain.com/pages/test works fine (redirects to pages/index.php), however http://mydomain.com/pages/test-page returns a 404 error. Anything that contains a dash after pages/ breaks. Everything else works. The rewrite rule should be: If the /pages/file.xx is found, display it. Otherwise send it to /pages/index.php
My .htaccess
RewriteEngine On RewriteBase /pages RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule . - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(am-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule (.*)$ /pages/$1/ [R=301,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9\-_\/\s]+)/?$ /pages/index.php [L]
EDIT With RewriteLog turned on, I get the following for URL "domain.com/pages/test-string":
xx.xx.xx.xx - - [03/Oct/2012:11:34:15 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] pass through /hsphere/local/home/domain/domain.com/pages/test-string xx.xx.xx.xx - - [03/Oct/2012:11:34:16 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] pass through /hsphere/local/home/domain/domain.com/splash/test-string
Here is the results for URL "domain.com/pages/test"
xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (2) [per-dir /hsphere/local/home/domain/domain.com/pages/] rewrite test -> /pages/test/ xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (2) [per-dir /hsphere/local/home/domain/domain.com/pages/] explicitly forcing redirect with http://domain.com/pages/test/ xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (2) [per-dir /hsphere/local/home/domain/domain.com/pages/] trying to replace prefix /hsphere/local/home/domain/domain.com/pages/ with /pages xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] escaping http://domain.com/pages/test/ for redirect xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] redirect to http://domain.com/pages/test/ [REDIRECT/301] xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (2) [per-dir /hsphere/local/home/domain/domain.com/pages/] rewrite test/ -> /pages/index.php xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (2) [per-dir /hsphere/local/home/domain/domain.com/pages/] trying to replace prefix /hsphere/local/home/domain/domain.com/pages/ with /pages xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#172fe530/initial] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] internal redirect with /pages/index.php [INTERNAL REDIRECT] xx.xx.xx.xx - - [03/Oct/2012:11:37:46 -0400] [domain.com/sid#17b39d20][rid#17c144e0/initial/redir#1] (1) [per-dir /hsphere/local/home/domain/domain.com/pages/] pass through /hsphere/local/home/domain/domain.com/pages/index.php
Upvotes: 2
Views: 3158
Reputation: 15364
Add lines for RewriteLog and RewriteLogLevel. I would start with log level 2 or 3 because it can get pretty long.
Upvotes: 0