hrsetyono
hrsetyono

Reputation: 4464

HTMLHelper link() added unintended path

I believe this is very simple question. Maybe that's why I can't find it on Google.

When I do this inside View/Product/view.ctp

echo $this->Html->link('Download PDF', 'app/files/product/1/manual.pdf');

The resulting URL is like this:

app/products/app/files/product/1/manual.pdf

It automatically added app/products since this is inside Product's view.

How to nullify that automatic addition?

Thanks

Upvotes: 0

Views: 69

Answers (1)

thaJeztah
thaJeztah

Reputation: 29137

You're specifying a relative url, causing your browser to append the url to the current url.

echo $this->Html->link('Download PDF', '/app/files/product/1/manual.pdf');

(note the leading slash /)

Should result in a link to http://example.com/app/files/product/1/manual.pdf

Upvotes: 3

Related Questions