logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: pache directive or module related to appending file suffixes
Author
mattie_linux



Joined: 19 Sep 2007
Posts: 1

PostPosted: Wed 19 Sep '07 4:44    Post subject: pache directive or module related to appending file suffixes Reply with quote

I recently moved from an old Apache 1.x server that i had no control over, to a new Apache 2.x server.

One strange thing changed:

We have some links that point to a page, foo.html.

But rather than have the href point to foo.html , the link points to "foo" and worked in the old system. It actually found foo.html, even though the link points to "foo" with no suffix.

(i didn't make these pages, and agree if you think it serves no purpose to do this).

When we switched to Apache 2, these "foo" links stopped working, and get the 404 messages I'd normally expect.

I'm willing to pour over my tree and fixes these links manually, but I'm wondering if anybody could identify the Apache directive or module that addresses this.
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 19 Sep '07 18:03    Post subject: Reply with quote

This might do what you want:
Code:
RedirectMatch permanent ^/([^.]*[^/.])$ /$1.html
Put this directive in the <Directory> block for your web root.
Make sure that mod_alias is loaded in your server.

The regular expression looks for URIs like this:
    a leading slash (/)
    followed by zero-or-more characters which are not dot (.)
    not ending with slash (/) or dot (.)
and replaces the URI with ".html" appended.

This might cause some confusion with subdirectories. For example:
    /SubDir will be replaced by /SubDir.html
    /SubDir/ will go to the SubDir subdirectory
    /SubDir/test will be replaced by /SubDir/test.html

Hope this helps.

-tom-
Back to top


Reply to topic   Topic: pache directive or module related to appending file suffixes View previous topic :: View next topic
Post new topic   Forum Index -> Apache