I noticed that when using mod_pagespeed on my site it updates my internal links.

When I am on / then my navigation looks like:

<ul>
    <li><a href="foo/bar"></a></li>
    <li><a href="example"></a></li>
</ul>

But when I am on /foo the same navigation looks like:

<ul>
    <li><a href="bar"></a></li>
    <li><a href="/example"></a></li>
</ul>

And when I am on /example it looks like:

<ul>
    <li><a href="/foo/bar"></a></li>
    <li><a href="example"></a></li>
</ul>

Is there a way to stop this behaviour as it's breaking some JS that relies on the href attribute of each link.

有帮助吗?

解决方案

You can disable this feature by adding

ModPagespeedDisableFilters trim_urls

to your pagespeed.conf file. See https://developers.google.com/speed/docs/mod_pagespeed/filter-trim-urls for more details.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top