installing below doc root

is there a way to modify the settings to use a subdirectory of document root? ie if my doc root is /var/www and i have webpagetest in /var/www/webpagetest what file(s) would i have to modify?

No, right now there are too many paths in the code that are absolute so it isn’t possible. It’s been on my list to look at for a while but it hasn’t happened yet.

Hi

I also wanted to install WPT in a sub-directory and spent many hours to modify the source code. It mostly works for the pages I’m used to see, but I think a 2nd view could find 404

Features :

  • the sub-directory is configured via settings.ini
  • default to empty string
  • should not conflict with $GLOBALS[‘cdnPath’]
  • probably 90% of all the urls are now prefixed with $GLOBALS[‘basePath’]

Missing / Dangers :

  • tested only the pages I need to see, but that should cover most of the
  • Works For Me(c) : tested on 2 different servers for now, but never tested anywhere else
  • CSS are not dynamic so the sub-directory is hardcoded. I did not took the time to re-generate them via PHP, but that’s what should be done
  • tried to have all rewrite rules to be relative instead of absolute
    eg: RewriteRule ^result/([a-zA-Z0-9_]+)$ ./result/$1/ [R]
    It mostly worked but at the end I finally had to turn off HTTP_MOD_REWRITE to have all work fine
  • should probably better use a makeURL() function rather than just prefixing strings

So, the time-consuming code is made, but lacks more testings on other environments
Do you want to try to merge this version with the HEAD ? How do you want me to provide the code ?

If you can send me a patch/diff against the HEAD I can look it over, merge the changes in and see if I can track down any cases where it isn’t handled.

Sorry it’s scattered all over the place, it sort of grew over 5 years and hasn’t been refactored since.

The fact this project exists is good enough :slight_smile:

please find attached the .patch file ( diff -wupr )
The file was renamed as .txt to pass the forum submit form

Awesome, thanks. I’ll go through it and merge. It will probably be a few days before I get to it bu much appreciated. I may see if I can refactor them all to use a central function while I’m in there.

Is there any update on running webpage test under a subdirectory?

Umm, the update is that I haven’t done any work on it yet but hopefully in the next quarter or so I will be able to tackle it. It’s mostly just grunt work going through all of the code and changing any absolute URLs.