There are a couple things in play here. First, the Alias
directive wants its right-hand-side to be an absolute, physical path on the server: you want
Alias /runs /mysite/xhprof/xhprof_html
<Directory /mysite/xhprof/xhprof_html>
Order allow,deny
Allow from all
AllowOverride All
</Directory>
Secondly, the RewriteRule RewriteRule .* index.php
matches not only http://.../runs
, but also any URL beginning with http://.../runs/
, even, for example, http://.../runs/css/...
. There are a couple ways to get around that.
Option 1: you could have a RewriteRule only redirect the root of the runs to index.php:
RewriteRule ^$ index.php
RewriteRule ^/$ index.php
Option 2: you could have the your mod_rewrite configure special-case things that exist as files, and redirect everything else to index.php
# Require the path the request translates to is an existing file
RewriteCond %{REQUEST_FILENAME} -f
# Don't rewrite it, but do stop mod_rewrite processing
RewriteRule .* - [L]
# Now, redirect anything into index.php
RewriteRule .* index.php
Option 3: you can special-case certain URLs, and redirect everything else to index.php
RewriteCond $1 !^css/
RewriteCond $1 !^js/
RewriteRule .* index.php
Option 4: if you want any URL mapping to a directory to show an index.php
file (like index.html
), there's a really simple way, which is probably what you want. You can put the following either in a .htaccess
or inside the <Directory>
block in directories.conf
:
DirectoryIndex index.php index.html
Footnote: the RewriteRules above basically throw away all of the URL for any request that ends up mapping to index.php
. That includes query-strings, so /runs/?foo=bar
is the same as /runs/
. If that's not what you want, you need a rule like
RewriteRule ^(.*)$ index.php/$1 [QSA]
which preserves both the path-info (the $1
part) and the query-string ("QSA" = "query-string append".)
Have I written way too much yet? :)
Alias
line, is it a typo or intentional that "/mysite/" isn't included? The right-hand-side of anAlias
directive should be the actual path on the filesystem. Also, can you post the last couple lines of your /var/log/apache2/access.log and .../error.log?index.php
is loading, the js, css which is present in the folder/mysite/happ/xhprof/xhprof_html/css
does not. Looking into this now.js & css
folders. Thanks. If possible please post you comment as an answer. Will accept it.