I'm starting a new thread here on an old topic because my posts to the old thread aren't getting answered.

All of our URLs that end in index.htm are having it removed, so that /folder/index.htm just ends at /folder/. The answer to this that you posted a long while ago has me confused. I've tried without success to fix this behavior but think it may come down to editing the code, and I have no idea how to do that. Can you give me some clue? I just want it to import all URLs as is and not mess with them by doing things like remove "index.htm" from the end.

Thank you

Comments

teschek’s picture

Still waiting. This is getting frustrating...

teschek’s picture

Does anyone on this list know whether or not the developer is still active and answer queries here? I've had an open issue for weeks now and have gotten no response whatsoever. Forward process on our import has been halted for weeks while I wait for an answer.

teschek’s picture

I've been trying and trying to get an answer to this question to no avail. The answer that was given several months ago didn't work for me and I am still stymied and unable to import my site without manually changing hundreds of pages by adding back in the index.htm to the end of all the links where it is being removed. I'm not sure what to do if dman doesn't answer my questions here. I know he is out there because he was answering someone else's questions quite a bit a few days ago. I even tried emailing him directly but got no response. Please, please, please dman, will you kindly take another look at this question for me? It's probably something simple that you can fix for me but without your help I'm dead in the water. All I get when I click on these truncated links is a directory of the folder. It won't display the index.htm page, even if it is there.

HELP!

teschek’s picture

I'm considering a workaround where I globally rename all my index.htm pages as something like toc.htm, then globally change all the links to /index.htm pages to /toc.htm pages. I've already confirmed that it works and the toc.htm isn't stripped out by Import HTML. While it's a workaround it isn't perfect because there are a lot of outside links into our website that will break if I leave them that way, so I'll probably have to manually go in and change many of them back to index.htm, or else create a bunch of redirectors. I'd rather not do that, so if you have some other idea of how I can get Import HTML to stop stripping index.htm from the end of my URLs, I'd greatly appreciate hearing it.

teschek’s picture

Should I proceed with my workaround, or do you have another option for me?

dman’s picture

I just don't have a simple answer.
My head has been in a massive project for the last month, and I've only been taking time out to answer ten-minute questions where I can.
This one felt like a 2-hour headscratcher to set up a test version to get it to the point where I could replicate the problem and try to get the idea of what was wanted and why. I know because the internal bit where it collapses the default documents into default folders has a lot of special logic and guesswork around it.

Generally, the idea was to remove redundant .html suffixes by design, and though an option to leave them has been there since the D5 version, it's not the method I'd recommend. On all (static) sites and servers I'd looked at up till now, the path /directory/index.html and /directory/ were equivalent. With the latter being preferred for technical reasons by Apache, webcrawlers, search engines etc.

There may be a short piece of code that could be fixed to make this happen, but there is a chance that doing so would implode all the rest of the logic that calculates child relationships.

/directory/child.html is obviously a child under /directory/
However it's not obviously a child of /directory/index.html, that's just a convention and a special rule.

This is one reason why /directory/index.html gets aliased to /directory very early in the process, so that ALL the other structural stuff can work at all.

What could/should happen is that the full/old alias is kept as a secondary option to prevent link breakage, and that *should* be getting done if the Legacy Aliases option is on.

Optionally, a secondary alias can be made that DOES have the old full suffix. This supports old links and hrefs. You want this unless the source URLS are entirely useless. The new node may end up with two aliases (thats OK) but the tidy one will be used internally by default. Uncheck this if you do NOT want old URL support.

If that's not happening, that's where to look.

Sorry for not letting you know sooner, but my answer is "this could be hard, it may take me half a day and may break any number of other things that will then all need to be retested, and I don't have half a day, and I actually think it's a regressive sort of move to be trying to force file suffixes onto CMS pages - like actually a bad idea, and there's a number of other alternatives like just adding aliases where needed or a simple .htaccess rewrite to convert */index.htm to * (which is what the normal webserver does anyway) but getting into understanding why you'd really be wanting to do this and a discussion about it is headspace I don't have and sorry I didn't reply earlier but I just did not have a good answer and was letting it settle until maybe I had some time to stop what I'm doing all the time now and think of a good answer but I can't dedicate that right now because it needs concentration to think about all the ramifications...

teschek’s picture

Thank you for your time on this issue. I'm beginning to wonder if this is more of a server problem on our end than a problem with your module. On our existing website when I type a URL without the index.htm the index.htm displays just fine, but on our Drupal server (running Linux) I get a directory of the contents of the folder rather than having it display the index.htm file. We do want it to display a list of files if there is no index.htm, however. I'll have our Linux guy dig around to see if he knows an answer to this but if you happen to know the answer off the top of your head...

teschek’s picture

Okay, I finally found the problem. You mentioned Replication Options so I played around with those and when I unchecked the "Relink references to resources to the new file storage location" option, the problem was solved! Hopefully it doesn't break something else that I'm unaware of.

dman’s picture

I would not think that that option would help your case at all.
The "resources" mentioned are the images and files that your site may embed or link to. Importing places those files over in sites/xx/files so the HTML needs to be updated to refer to them there.

That option should not be affecting the alias generation of the imported pages.
Your problem sounded more like an issue with the "Legacy Aliases" option

teschek’s picture

I do have the "Extra File Storage Path" setting turned off, not set to blank but set with a simple period as there is apparently a bug in the software that won't let it work when it is blank (this was discussed in a previous thread). We do wish to "recreate a messy site". The help statement also says that "Only relative and site-relative links are rewritten" which is what gave me the idea of trying this, as we don't want our relative links to be rewritten.

Whatever the case, it does seem to work to do exactly what we want. I tried every permutation of the "Legacy Aliases" and "Trim Suffixes" options and the best is to check Legacy Aliases and uncheck Trim Suffixes.

dman’s picture

OK, that makes sense then.
Yes, if not moving the files into the Drupal file storage path, then it is safe to not rewrite the resource paths.

By not rewriting, you are leaving yourself open to some issues down the track however if you start to use other Drupal features.
EG a page at /old/path/to/page.htm may comfortably embed an image at /old/path/to/image.jpg simply by going src="image.jpg"

... And this will work. for now.

But if you try to edit that page at node/123/edit, then the image will appear broken.
And if you were to aggregate that page in a view, then the image will appear broken.
The same applies to links to other html pages, and any number of things.

I used to maintain relative links as much as I possibly could, but the fact is, with Drupal (and any CMS it seems) internal relative links really have to be replaced with root-relative ones.

teschek’s picture

Right now if I edit an existing node at something like /node/123/edit, the images do NOT appear as broken. They are fully displayed in the editor. I am concerned, however, about the possibility of these image links breaking if I were to aggregate the pages that they are on in a View. This isn't something I know how to test at the moment, so I don't know whether it is an actual problem or not. Which setting in import2HTML is it that would avoid this potential problem?

dman’s picture

If your links are root-relative (they start with a /) and you've merged your files directly over Drupal core (messy, but possible) then you may be OK.
My warning is about really-relative links - those that go up and across or rely on the source being in a specific folder in relation to the target.

If you have links that use ../../.. to get to the top and down again, those are still just relative and could create problems. It just happens that your webserver/browser is flattening that path sometimes, and it just seems to work.

in import_html, the setting is to shift all files into the files directory and relink to them. As you are not doing that, this is just a potential concern I'm warning about.
If you've rewritten your links to be root-relative (eg wget with the --mirror option does that I think) then you should be OK.

teschek’s picture

That's good news, as our links ARE root relative.

Thanks for your help.

Bill

dman’s picture

Status: Active » Closed (works as designed)

old issue, seems settled

teschek’s picture

Yes, it's settled, thanks.