Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

BillH

Re: Configuring the HTTP URL Extension

Thank you Martin. Using either / or nothing produced the correct URL. And thanks for the link – I hadn't found that page.

Case closed.
Bill
martin

Re: Configuring the HTTP URL Extension

You didn't give us an example of a path and URL you want to generate from it. So it is difficult to help you.
But in general the "Web root path" should NOT contain any protocol nor hostname. It should contain only the root path. So maybe /wp-content/ or maybe only / or empty.
See https://winscp.net/eng/docs/extension_generate_http_url#options
BillH

Configuring the HTTP URL Extension

I would like to use this extension to generate URLs to insert in my WordPress site to be able to link to PDF files uploaded with WinSCP. (I used to upload with a plugin which also gave me the HTTP URLs but my site host is now preventing its use.)

No matter what I put into the Web root path in the Configuration panel I always get the result
Command failed with return code 1
Error: ** The path /wp-content/uploads/folder/subfolder/filename.pdf is not under web root http://sitename/. **

I've tried all combinations of putting in and leaving out the http:// and adding and leaving out /public_html but it makes no difference to the end result, which is always as above.

I saw that a previous poster who was having difficulty with this was advised to use Ctrl+Shift while clicking on Generate HTTP URL to copy the command to the clipboard, and I give the result here for one attempt if it helps:
powershell.exe -ExecutionPolicy Bypass -STA -NoProfile -File "C:\Program Files (x86)\WinSCP\Extensions\GenerateHttpUrl.WinSCPextension.ps1" -webRoot "http://sitename" -rootPath "" -hostName "" -serverName "92.204.68.69" -path "/wp-content/uploads/foldername/subfoldername/"  -pause -clipboard  "filename.pdf"

Generating the URL with path is no problem and gives:
/wp-content/uploads/foldername/subfoldername/filename.pdf

I privately attach the Log file from this morning's attempts.

I hope someone can help.

Bill
WinSCP 6.3.4, build 14955 2024-06-17 under Windows 11