Forum Moderators: open

Message Too Old, No Replies

Redirection help needed

Incomplete URL

         

Geetu

10:01 am on Apr 6, 2004 (gmt 0)

10+ Year Member



I have a major problem. A very crucial page of our site is listed at a lot of sites with a wrong URL(missing the html extension). for example it is like

[example.com...] instead of [example.com...]

we cannot figure out a way to redirect it and hence it results in a 404 error.

Plz help it is a major problem.:-(

[edited by: tedster at 12:04 pm (utc) on April 6, 2004]
[edit reason] use example.com [/edit]

tombola

11:09 am on Apr 6, 2004 (gmt 0)

10+ Year Member



If you run Apache, you can use content negotiation.
This way people can access your pages with or without filename extension, so it won't matter if they use [example.com...] or [example.com...]

Put this line in your .htaccess file:

Options ExecCGI MultiViews

Geetu

12:39 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



Thanks a lot. but the issue is that it is not the index page. I had written it just for an example.it is another page which is directly in the domain and not in any directory.Plz tell me if there is a solution to it.

Geetu

12:51 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



Thanks a lot. but the issue is that it is not the index page. I had written it just for an example.it is another page which is directly in the domain and not in any directory.Plz tell me if there is a solution to it.

encyclo

12:57 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it affects just one file, try creating a directory with that name: for example, if the file name is widget.html, create a directory "widget". In the "widget" directory, add an index file which redirects to the correct file. If you have PHP available on your server, you can create index.php with the contents:

<?php  
header("HTTP/1.1 301 Moved Permanently");
header("Location: [example.com...]
header("Connection: close");
?>

You can do the same with ASP if you're on a Windows server, or at the last resort, you can create an index.html and use a meta refresh.

Hope that helps!

tombola

2:13 pm on Apr 6, 2004 (gmt 0)

10+ Year Member



Content negotiation works for ALL documents no matter what their name is and no matter in which directory they are.

For example: with content negotiation, the url [example.com...] will deliver the same page as this url: [example.com...]

encyclo

7:41 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Content negotiation is very useful, but can be server-intensive. Whilst Tombola's suggestion is excellent in many cases, it is not always possible to do this on shared hosts who often don't have the content negotiation module loaded.

You will need to check with your hosting company on this one (or try the directory approach).

jdMorgan

9:03 pm on Apr 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> we cannot figure out a way to redirect it and hence it results in a 404 error.

For Apache, using your "/index" example URL:


RedirectMatch 301 ^/index$ http://www.example.com/index.html

Substitute your actual page name in both side of the RedirectMatch directive.

Jim

Geetu

7:25 am on Apr 8, 2004 (gmt 0)

10+ Year Member



Thanks to all of you.
I solved my problem :-)

You all are Great. Webmasterworld is a great place.

Thanks again.