Forum Moderators: phranque
RewriteCond %{REQUEST_URI} !^/hardlopen
RewriteCond %{REQUEST_URI} !^/biking
RewriteCond %{REQUEST_URI} !^/outdoor
RewriteRule ^/?([^A1]*)/$ ${Catmap:$1} [R=301,L,NC]
An url like : [domain.nl...]
give in a logfile:
(3) applying pattern '^/?([^A1]*)/$' to uri 'running/'
(4) RewriteCond: input='/running/' pattern='!^/hardlopen' => matched
(4) RewriteCond: input='/running/' pattern='!^/biking' => matched
(4) RewriteCond: input='/running/' pattern='!^/outdoor=> matched
(5) map lookup OK: map=Catmap[txt] key=running -> val=hardlopen/
(1) escaping [domain.nl...] for redirect
(1) redirect to [domain.nl...] [REDIRECT/301]
so far so good.
chanigng the url to :
An url like : [domain.nl...]
give in logfile:
(3) applying pattern '^/?([^A1]*)/$' to uri 'recreation/'
(3) add path info postfix: /home/epages5/eproot/Shared/WebRoot/recreation -> /home/epages5/eproot/Shared/WebRoot/recreation/
it seems that the patern is not correct for the uri?
Eric
it seems that the patern is not correct for the uri?
/recreation is treated as a file?
If you would request /foo/bar/other which would be mapped to /home/epages5/eproot/Shared/WebRoot/foo/bar/other and the folder /foo/ does not exist, you'd look against a physical path of /home/epages5/eproot/Shared/WebRoot/foo with path_info /bar/other. foo is treated as a file (whether it exists or not). To give you the chance to match against something with your RewriteRule which looks more like the original request, mod_rewrite adds path_info back to the filename.
Why isn't it treated in the same way as /running ?
ls: /home/epages5/eproot/Shared/WebRoot/running: No such file or directory
ls: /home/epages5/eproot/Shared/WebRoot/recreation: No such file or directory
these are only intermediate steps.
www.domain.nl/running is rewriten to an url ePages (our e-commerce software) knows. This is done in the last part of htaccess.
ls: /home/epages5/eproot/Shared/WebRoot/running: No such file or directory
As you can see, there's no trailing slash (stripped), so it's treated as a file, too.
BTW: You are aware that ^/?([^A1]*)/$ does not (only) mean "not the string A1" but not 'A' (and not 'a' due to your NC flag) and not '1', so it won't match Apple nor Chicago nor recreation, too.
Sorry for jumping in, but ^/?([^A1]*)/$ will not match the path containing /running either because of the /$ at the end, it actually stops processing sooner on recreation than on running.
And, the /? is unnecessary in the .htaccess file, unless there is something I am missing, because the preceding / is not present. In the httpd.conf it would be necessary, but the path matched in the .htaccess will (should) not ever begin with /.