The problem here is that it is the client (browser or search robot) which much resolve the relative URL-paths that it finds in links on your pages to the full canonical URLs that it must use to perform HTTP fetches from your server.
The client will resolve the page-relative URLs in your <a href="xyz">, <img src="xyz">, and <link href="xyz"> include tags by using the address that it 'sees' in its address bar as the base address.
Since you have changed the page URL seen by the client from http:
//localhost/mysite/sections.php to http:
//localhost/mysite/news/detail/1, the client now sees the two extra "directory levels" in that URL. Therefore, it will resolve your page-relative links using /news/detail/ as its base address, and the result will be that it tries to fetch the image from [
localhost...] (The "/1" in your error report above should only occur if you added a trailing slash after "/1" in the URL that you request, or if you rewrite that address to add the trailing slash using another rewriterule).
The solution to this problem is to either use a canonical URL like <img src="http://localhost/mysite/images/logo.gif">, or to use a
server-relative URL like <img src=
"/images/logo.gif"> -- Note that leading slash.
In the first case, the browser will completely ignore the address in its address bar, and load the image from the complete URL as given. In the second case, the browser will discard all of the path-info and use only the "domain name", appending "/images/logo.gif" to it, and therefore fetching the image from the correct address.
Your named anchors/URL-fragment problem can be similarly fixed by including the leading slash and referring to <a href="/#anchor"> instead of <a href="#anchor">.
Jim