Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Rewrite example/ to example.html

4:39 pm on Dec 17, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:June 26, 2007
posts: 88
votes: 0

Sorry if this has been answered before, I tried searching for it, but I am not sure what to search for...

Anyway, I had a website with urls like www.domain.org/example/

Recently I changed the site completely, and now I have some ulrs that read www.domain.org/example.html.
The problem is, the old urls (via Google) simply show the page but without styling. So I want to rewrite or redirect the example/ urls to example.html. How do i do this?

I tried:

Redirect [domain.org...] [domain.org...]

but this doesn't work?

4:54 pm on Dec 17, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

That's because you have misunderstood the syntax to use for a redirect.

However, you don't seem at all clear as to whether you need a rewrite or a redirect - and they are completely different things.

You need to make sure that the content is directly available at only one URL and that all other variations issue a redirect.

In some cases you may also need a rewrite to connect the URL request to the internal filename for that content, when the tail of the URL differs from the actual filename.

If styling is not being seen, then it is likely that you need to begin the links to the stylesheet with a / and state the full folder-path to the stylesheet as it is the browser that resolves the stylesheet location based on the URL for the current HTML page.

4:56 pm on Dec 17, 2008 (gmt 0)

Full Member

10+ Year Member

joined:Dec 20, 2004
votes: 0

Test, if RedirectMatch fits your needs. But make sure, you're specifying the statuscode 301:

RedirectMatch 301 ^/([^/]+)/$ http://www.example.com/$1.html

What went wrong with your redirect directive? the first argument must be an URl-path, i.e.

5:12 pm on Dec 17, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:June 26, 2007
votes: 0

Thank you Caterham, it worked.

The problem was that the site used to be in Wordpress. I decided I didn't need a CMS and redid the site "static". I only noticed the problem after I was done.

Anyway, it is working now. Thanks again.

@g1smd: Yes, if I was unable to find a htaccess solution my next option was to rewrite the css-urls, but I was hoping I wouldn't have to. And I don't :-)