Forum Moderators: phranque

Message Too Old, No Replies

mysite.com/ not working, must use mysite.com/index.htm

         

forbeer

5:58 pm on Jun 15, 2009 (gmt 0)

10+ Year Member



hello,

noob here.

i am sure this has been covered 1000 times but i don't know what to search on.

my problem is that when visiting example.com/ i get the error:
"Not Found
The requested URL / was not found on this server."

but when i use the url example.com/index.htm the site appears as it should.

if it matters, i am redirecting all http traffic to the https site, i.e. http://example.com redirects to [example.com...] and this is working once i add index.htm

many thanks.

[edited by: jdMorgan at 7:06 pm (utc) on June 15, 2009]
[edit reason] example.com [/edit]

jdMorgan

7:08 pm on Jun 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If not already done, define index.htm as your DirectoryIndex file, or add it to the existing DirectoryIndex list. See Apache mod_dir

However, if https://example.com/ works and http://example.com/ does not, then the problem is likely a defect in your http->https redirect code.

Jim

forbeer

7:52 pm on Jun 15, 2009 (gmt 0)

10+ Year Member



thank you for the response.
this is a snip of the http.conf:

DirectoryIndex index.htm

#to force https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule (.*) [%{HTTP_HOST}%{REQUEST_URI}...]

jdMorgan

1:15 am on Jun 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure if that's your SSL-server or non-SSL container, but try the following in the non-SSL server's config section:

DirectoryIndex index.htm
#
# force https
Options -MultiViews
RewriteEngine on
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

This disables multiviews (content-negotiation) which can interfere with rewrites, and it also uses the server-native environment variable SERVER_PORT instead of the non-native HTTPS variable. The redirect type (301) is explicitly declared, and this rule, if matched, will be invoked immediately.

Jim

forbeer

8:13 pm on Jun 30, 2009 (gmt 0)

10+ Year Member



i fixed it. it was a mod_rewrite rule:

RewriteRule ^([a-zA-Z0-9_/-]+)/?$ $1\ [L]

once i commented the above line out everything is working as it should.

thanks for your help.