Forum Moderators: phranque
http://www.example.com/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule sitemap\.xml /bin/sitemap.php [nocase]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(/?[^/]+) /index.php [L]
Deny from all
Allow from all
Options -Indexes
php_value magic_quotes_gpc Off
Order deny, allow
[Sat Apr 20 00:26:35 2013] [error] [client 192.168.0.1] File does not exist: /sites/example.com/public/thema-s, referer: http://www.example.com/thema-s/bedrijfsuitje/
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] add path info postfix: /sites/example.com/public/thema-s -> /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] strip per-dir prefix: /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje -> thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] applying pattern '(.*)' to uri 'thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje'
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] add path info postfix: /sites/example.com/public/thema-s -> /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] strip per-dir prefix: /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje -> thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] applying pattern 'sitemap\.xml' to uri 'thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje'
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] add path info postfix: /sites/example.com/public/thema-s -> /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] strip per-dir prefix: /sites/example.com/public/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje -> thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (3) [perdir /sites/example.com/public/] applying pattern '^(/?[^/]+)' to uri 'thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje'
192.168.0.1 - - [20/Apr/2013:00:26:35 +0200] [www.example.com/sid#b8f85f40][rid#b915bec0/initial] (1) [perdir /sites/example.com/public/] pass through /sites/example.com/public/thema-s
I have set up rewrite logging.
/bedrijfsuitje/schadelijk-bedrijfsuitje /sites/example.com/public/ applying pattern '(.*)' to uri applying pattern 'sitemap\.xml' to uri applying pattern '^(/?[^/]+)' to uri Apache is searching the file system for a particular path, while it shouldn't do that, because the path is only virtual
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule sitemap\.xml /bin/sitemap.php [nocase]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(/?[^/]+) /index.php [L]
Deny from all
Allow from all
Options -Indexes
php_value magic_quotes_gpc Off
Order deny, allow Options -Indexes
Order deny, allow
Deny from all
Allow from all php_value magic_quotes_gpc Off
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule sitemap\.xml /bin/sitemap.php [nocase]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(/?[^/]+) /index.php [L]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule sitemap\.xml /bin/sitemap.php [nocase]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(/?[^/]+) /index.php [L]
# start of new rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php [L] # matches anything not previously matched
# end of new rule
Deny from all
Allow from all
Options -Indexes
php_value magic_quotes_gpc Off
ErrorDocument 404 /404.php
192.168.0.1 - - [20/Apr/2013:15:34:05 +0200] [www.example.com/sid#b8b66f40][rid#b8d58338/initial] (3) [perdir /sites/example.com/public/] applying pattern '^(/?[^/]+)' to uri 'thema-s/bedrijfsuitje/origineel-bedrijfsuitje/'
192.168.0.1 - - [20/Apr/2013:15:34:05 +0200] [www.example.com/sid#b8b66f40][rid#b8d58338/initial] (2) [perdir /sites/example.com/public/] rewrite 'thema-s/bedrijfsuitje/origineel-bedrijfsuitje/' -> '/index.php'
192.168.0.1 - - [20/Apr/2013:15:34:05 +0200] [www.example.com/sid#b8b66f40][rid#b8d58338/initial] (1) [perdir /sites/example.com/public/] internal redirect with /index.php [INTERNAL REDIRECT]
if you are on 2.2 you can use the RewriteLog Directive:
Context: server config, virtual host
I also noticed that the initial version of my htaccess (first post) DOES match the URL http://www.example.com/thema-s/bedrijfsuitje/schadelijk-bedrijfsuitje if I stick a / to the end. I am not so good at regexes, but does this sound logical to you?
I knew there had to be a catch
LogLevel Directive
...
Context: server config, virtual host, directory
A period in an URL is not illegal, of course, but they're an amazingly bad idea.
the only problem with a period is its ambiguity in regular expressions
[edited by: Dideved at 6:45 pm (utc) on Apr 21, 2013]
And, unlike lowlines-- but in common with hyphens-- they (periods) are not encompassed under \w
[^/]+. That's dead easy. If the goal is to match *any* path and *any* filename, as was the case that started this discussion, then .*, which is also dead easy.