Is there a way to make all links and URLs in my site end with HTM or HTML extension?

Is there a module that has this level of access that can be configured to display all URLs with an .htm or .html ending?

Is this something that is only accomplished via the .htaccess file?

Thanks.

Comments

BrianKlinger’s picture

Using the path module you can rename your url to anything you want, so once you enable the path module, you can put whatever url you want into that field.

i.e. yoursite.com/node/3 is showing up as your url, you type yourdirectory/yourpage.html into the url field, and once you submit that, the new url will be yoursite.com/yourdirectory/yourpage.html (you don't have to include a directory name, I'm just showing you the possibilities and flexibility).

linulo’s picture

As BrainaJubal said, the path module present in every Drupal installation can do what you want. With the pathauto module you can even bulk replace all existing site addresses and automatically generate URIs.

For example if you create a new node with the address /node/15 and the title "Products", you can configure pathauto to generate a path alias /products.html for that node.

jbrown’s picture

Why would you want to do that?

--
Jonathan Brown
http://openpackage.biz/

--
Jonathan Brown
http://jonathanpatrick.me/

johnnoc’s picture

Maybe Zoologico find that it's aesthetically pleasing or even for nostalgic purposes. Like some people still want to have www because they are just more used to having it and some don't. Well...to each his own...we all have our own preferences :-)

I agree with Linulo and BrianJubal. Either just the core path module (manually) or with pathauto (as the name implies, automatic)

John
--------------------------------
admin - Drupal Norge (http://www.drupalnorge.no)
project maintainer - Norwegian Bokmål Localization Project
project co-maintainer Norwegian Nynorsk translation

Phillip Mc’s picture

Hi Jonathan,

I have come across projects migrating to Drupal where the client wanted the existing links (that had the .html extension) in search engines and bookmarks to remain live when the initial change over takes place.

Phil

linulo’s picture

Personally, I would use extension-less URIs (with path module) and use Apache URL Rewrite Rules to provide the correct addresses for outdated bookmarks. i.e. you could use redirects to guide users with old links to the new addresses instead of being compatible forever.

johnnoc’s picture

If the purpose is SEO, I think I agree with Linulo. You can use .htaccess (there's a handbook page that explains this, if i remember correctly) or if you are not confident in tweaking code, you can install a module like Go - url redirection.

Zoologico’s picture

I may not be understanding the reasoning behind the request well enough, but I wanted to know if this was possible.

I have inquired as to why and if there is is something specific they are trying to accomplish. I may be able to help them reach the final goal more easily.

Thank you all kindly for your prompt and through responses.

linulo’s picture

"Yes, no problem." :-)

Zoologico’s picture

What happens if a pathauto controlled alias is generated and it happens to match another one exactly?

For example, if I title one: "My First Blog Entry"

Then another user titles theirs "My First Blog Entry"

In this scenario I am just the "content/[title-raw].htm" setting.

What am I in for?

johnnoc’s picture

I think the second one is suffixed by (1) or -1, can' temember which one of the two.

John
---------------------------------
http://www.drupalnorge.no
hvor oversettere, utviklere, leverandører, og brukere av Drupal i Norge samles!

midmanhattan’s picture

You'd want to do that if you have a site that's been around for years and is indexed in seach engines with the page /xxx.htm.

If you don't allow the page to be found with the htm extension, you are creating a disaster for thousands of incoming links and bookmarks? No?

We are considering implementing Drupal on a site that's close to 7000 pages of content started back in 1998. Wouldn't we almost have to keep the htm extensions or, basically, start from scrtach with our back links, bookmarks and SEO?

jbrown’s picture

You could use Path Redirect to create "301 Moved Permanently" redirects from old urls to new ones.

Google responds really well to clean urls with keywords.

In theory, web browsers should rewrite their bookmarks with a 301 (to avoid a redirect in future and in case the old link stops working), but I don't know if any have implemented this.

--
Jonathan Brown
http://openpackage.biz/

--
Jonathan Brown
http://jonathanpatrick.me/

dthurman’s picture

Sometimes not messing with redirects can help avoid disasters. Yahoo was known to not take kindly to redirects, if the site can retain what it had in a CMS switch over, the better.

All methods described will work, we have a client that will want a specific URL extension so this is great to know Drupal can do.