richardk wrote:Right, i misunderstood. Where are you getting the test.sites.example.com/clients/test/blog/wp-admin/install.php URL? After a redirect or in the source of the page. I think you'd have to change the base path (in Wordpress), the redirect or the HTML link.
/data/clients/test/mydir/
/data/clients/test/mydir/index.html
http://test.sites.example.com/mydir/
http://test.sites.example.com/mydir/index.html
http://test.sites.example.com/cms
I'd like specifying just the directory name to work as would be expected (search based on DirectoryIndexes directive). If no index files are found, then it should display the 403 (because i don't want to list the contents of a directory)... but if an index file is found, it should be execute
(Note the lack of a trailing / ) - This executes the correct index.php (in the specified directory), however it doesn't seem to register the fact that it's current dir is now /cms/ so all relative URLs (ie. css/style.css or logo.jpg) are all looked for based on the webroot and not webroot/cms/. (ie. the file is not found /logo.jpg but it is located in /cms/logo.jpg )... when I add the trailing slash to the URL everything behaves normally. Any idea how to fix this? maybe some way to force the trailing / or... ?
RewriteCond %{DOCUMENT_ROOT}/clients/%1%{REQUEST_URI}/ -d
RewriteCond %{DOCUMENT_ROOT}/clients/%1%{REQUEST_URI}/ -d [OR]
RewriteCond /clients/%1%{REQUEST_URI}/ -F
RewriteCond /usr/local/staff/cmd/cmd/trunk/cmdv3%{REQUEST_URI}/ -d
RewriteRule ^(cms|flash|html|slideshow)(/.*[^/])?$ http://%{HTTP_HOST}$0/ [R=301,L]
RewriteEngine On
/data/clients/test/mydir
aka.
/data/sites/sites.example.com/htdocs/clients/test/mydir/
(in the htdocs dir, 'clients' is actually a symlink to /data/clients/ - but i don't think this has any effect, just wanted to mention it in case).
http://test.sites.example.com/mydir
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir HTTP/1.1" 301 349
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir/index.php HTTP/1.1" 404 321
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:28:12 2009] [error] [client 90.178.229.150] script '/data/sites/sites.example.com/htdocs/clients/test/mydir/index.php' not found or unable to stat
/data/clients/test/blog
aka.
/data/sites/sites.example.com/htdocs/clients/test/blog/
http://test.sites.example.com/blog/
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:23:05 -0500] "GET /blog/ HTTP/1.1" 403 315
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:23:05 2009] [error] [client 90.178.229.150] Directory index forbidden by Options directive: /data/sites/sites.example.com/htdocs/clients/test/blog/
http://test.sites.example.com/blog
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:35:25 -0500] "GET /blog HTTP/1.1" 301 348
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:35:26 -0500] "GET /blog/index.php HTTP/1.1" 302 -
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:35:26 -0500] "GET /clients/test/blog/wp-admin/install.php HTTP/1.1" 404 347
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:35:26 2009] [error] [client 90.178.229.150] File does not exist: /data/sites/sites.example.com/htdocs/clients/test/clients
http://test.sites.example.com/clients/test/blog/wp-admin/install.php
http://test.sites.example.com/blog/wp-admin/install.php
http://test.sites.example.com/blog/
==> httpd/sites.example.com-access_log <==
90.178.229.150 - - [17/Sep/2009:10:42:56 -0500] "GET /blog/ HTTP/1.1" 403 315
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:42:56 2009] [error] [client 90.178.229.150] Directory index forbidden by Options directive: /data/sites/sites.example.com/htdocs/clients/test/blog/
<VirtualHost *:80>
ServerName sites.example.com:80
ServerAlias *.sites.example.com:80
ServerAdmin webmaster@example.com
DocumentRoot /data/sites/sites.example.com/htdocs
ErrorLog logs/sites.example.com-error_log
CustomLog logs/sites.example.com-access_log common
DirectoryIndex index.php index.html index.cgi
AliasMatch ^/clients/[^/]+/(index\.php)?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/index.php"
AliasMatch ^/clients/[^/]+/(confirmation\.php)$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/confirmation.php"
AliasMatch ^/clients/[^/]+/(contact\.php)$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/contact.php"
AliasMatch ^/clients/[^/]+/cms/?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/cms/index.php"
AliasMatch ^/clients/[^/]+/cms/(.+)?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/cms/$1"
AliasMatch ^/clients/[^/]+/flash/?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/flash/index.php"
AliasMatch ^/clients/[^/]+/flash(/(.*))?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/flash/$2"
AliasMatch ^/clients/[^/]+/html/?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/html/index.php"
AliasMatch ^/clients/[^/]+/html(/(.*))?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/html/$2"
AliasMatch ^/clients/[^/]+/slideshow/?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/slideshow/index.php"
AliasMatch ^/clients/[^/]+/slideshow(/(.*))?$ "/usr/local/staff/cmd/cmd/trunk/cmdv3/slideshow/$2"
Options +FollowSymlinks Indexes ExecCGI
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?sites\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.+)\.sites\.example\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/clients/%1%{REQUEST_URI}/ -d
RewriteRule ^/.*[^/]$ http://%{HTTP_HOST}$0/index.php [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.)?sites\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.+)\.sites\.example\.com$ [NC]
RewriteRule ^/.*$ /clients/%1$0 [QSA,E=CMD_SITE:%1,PT,L]
</VirtualHost>
I get a 404 error with the following log:
- Code: Select all
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir HTTP/1.1" 301 349
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir/index.php HTTP/1.1" 404 321
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:28:12 2009] [error] [client 90.178.229.150] script '/data/sites/sites.example.com/htdocs/clients/test/mydir/index.php' not found or unable to stat
http://%{HTTP_HOST}$0/index.php
http://%{HTTP_HOST}$0/
If I could somehow rewrite anything matching <url>/clients/%1% (%1% = 'test' in this case) then I could rewrite the url to be: http://test.sites.example.com/blog/wp-admin/install.php - I think (hope) this would work... Does this make sense?
RewriteCond %{HTTP_HOST} !^(www\.)?sites\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.+)\.sites\.example\.com$ [NC]
RewriteCond %1?$1 ^([^\?]+)\?\1$ [NC]
RewriteRule ^/clients/([^/]+)(/(.*))?$ /$3 [R=301,L]
richardk wrote:I get a 404 error with the following log:
- Code: Select all
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir HTTP/1.1" 301 349
xxx.xxx.xxx.xxx - - [17/Sep/2009:10:28:12 -0500] "GET /mydir/index.php HTTP/1.1" 404 321
==> httpd/sites.example.com-error_log <==
[Thu Sep 17 10:28:12 2009] [error] [client 90.178.229.150] script '/data/sites/sites.example.com/htdocs/clients/test/mydir/index.php' not found or unable to stat
The mod_rewrite redirect adds index.php (the second access log entry should be for /mydir/). Replace
- Code: Select all
http://%{HTTP_HOST}$0/index.php
with
- Code: Select all
http://%{HTTP_HOST}$0/
RewriteRule ^/.*[^/]$ http://%{HTTP_HOST}$0/index.php [R=301,L]
http://test.sites.example.com/mydir
http://test.sites.example.com/mydir/index.php
http://test.sites.example.com/mydir/
==> httpd/sites.example.com-access_log <==
xxx.xxx.xxx - - [18/Sep/2009:08:29:56 -0500] "GET /mydir/ HTTP/1.1" 403 316
==> httpd/sites.example.com-error_log <==
[Fri Sep 18 08:29:56 2009] [error] [client 213.220.219.188] Directory index forbidden by Options directive: /data/sites/sites.example.com/htdocs/clients/test/mydir/
RewriteRule ^/.*[^/]$ http://%{HTTP_HOST}$0/index.html [R=301,L]
Options +Indexes
richardk wrote:Do not specify an index file at all, when we fix the problem Apache can handle that.
What happens if you comment out the mod_rewrite and go to /clients/test/mydir/?
What happens if you comment out the AliasMatches (but not the mod_rewrite) and go to /mydir/?
What happens if you comment out both and go to /clients/test/mydir/?
Did you check for <Directory>s that could be conflicting?
Also add
- Code: Select all
Options +Indexes
so you can see the directory.
Options +FollowSymlinks Indexes ExecCGI
Options FollowSymLinks Indexes ExecCGI
richardk wrote:Try replacing
- Code: Select all
Options +FollowSymlinks Indexes ExecCGI
with
- Code: Select all
Options FollowSymLinks Indexes ExecCGI
Users browsing this forum: No registered users and 5 guests