Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: configure htaccess from root to Index.html

  1. #1
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default configure htaccess from root to Index.html

    Hi all,

    I have a very simple problem but since I just started to learn coding, I still can not find the answer.. Here is the problem:
    I try to configure a htaccess to redirect from my domain www.vectsore.com to my index file www.vecstore.com/Index.html which is the homepage of the website.
    As i am hosted on Godaddy, they gave me a htacces but - i don't know why- it doesn't work :


    rewriteengine on
    rewritecond %{HTTP_HOST} ^www.vecstore.com$ [OR]
    rewritecond %{HTTP_HOST} ^vecstore.com$
    rewriterule ^vecstore\.com$ "http\:\/\/vecstore\.com\/vecstore\.com\/Index\.html" [R=301,L] #50413b751e5f6


    i noticed that the problem could come from the "/" after the Index.html (http://www.vecstore.com/Index.html works, http://www.vecstore.com/Index.html/ doesn't). But i didn't find how to erase it. Could somebody help me with that ?

    Thansk a lot in advance!

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by johnmcjack View Post
    I try to configure a htaccess to redirect from my domain www.vectsore.com to my index file www.vecstore.com/Index.html which is the homepage of the website.
    Apache is typically set up to do this automatically. I've -never- seen a web host that doesn't display the index page when given a URL without a file specified. You shouldn't need to do anything.
    Quote Originally Posted by johnmcjack View Post
    i noticed that the problem could come from the "/" after the Index.html (http://www.vecstore.com/Index.html works, http://www.vecstore.com/Index.html/ doesn't).
    take a look at your code:
    Code:
    #this command is misspelled
    #   should be RewriteEngine
    # the setting is misspelled also
    #   should be On
    rewriteengine on
    
    #this command is misspelled
    #   should be RewriteCond
    rewritecond %{HTTP_HOST} ^www.vecstore.com$ [OR]
    
    #this command  is misspelled
    #   should be RewriteCond
    rewritecond %{HTTP_HOST} ^vecstore.com$
    
    #this command is misspelled
    #  should be RewriteRule
    rewriterule ^vecstore\.com$ "http\:\/\/vecstore\.com\/vecstore\.com\/Index\.html" [R=301,L]
    # This rewrite doesn't make any sense.
    # If someone visits vecstore.com (NO www, NO path),
    #   they'll be redirected to  http://vecstore.com/vecstore.com/Index.html
    # Is that what you want?
    
    # one of the two above conditions will almost always be true,
    #  and it's not really testing what you want to test: it's testing if the Host name matches.
    #  Unless you're running more than one website out of the same root directory,
    #  the Host name will always be some variation of your domain name.
    #  IIUYC, you should be looking for a missing filename.
    #  Maybe something like this:
    
    RewriteEngine On
    
    RewriteCond %{REQUEST_URI} !-f # if requested url is *not* a real file
    RewriteCond %{REQUEST_URI} -d # but *is* a directory
    RewriteRule ^.*$ http://vecstore.com$1/index.html [R=301,L] # redirect to index file for that directory
    
    # this is untested, so you may need to fiddle with parts of it.
    # I'll try it out for you when I get home.
    # If I've misunderstood what you're trying to do, please explain.

  3. #3
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi traq,

    Thanks a lot for your very complete answer.

    I didn't know about the apache redirection.. I don't know why it doesn't work for me, my host is go daddy, so not the worst one..

    I tried out your code, unfortunately still no change : it still send me to http://www.vecstore.com/Index.html/ which doesn't work because of the "/" in the end..
    If you have any other idea, please let me know, i'm totally lost!
    Thanks a lot in advance!

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Apache is typically set up to do this automatically. I've -never- seen a web host that doesn't display the index page when given a URL without a file specified. You shouldn't need to do anything.
    Godaddy certainly has this set up by default.
    I've used .htaccess on their servers and that works fine too, so the problem is in the code, not the host.

    The first thing that jumps out at me... why are you using Index.html rather than index.html? It's supposed to be lowercase, and that's the default (and will almost certainly work). Filenames (and directories) in the URL (but not the domain name) are case-sensitive, so this is different-- use a lowercase "i" and it should all be fixed.


    If you specifically want Index (uppercase), then you could create a redirect from index.html to Index.html.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    try Daniel's suggestion.
    Code:
    RewriteEngine On
    RewriteRule index.html Index.html
    # that's assuming you want the Capital "Index.html".
    possible explanation: your server is configured to use index.html, and so your .htaccess file is not actually matching our rules (one redirect has already occurred, and the URI is actually "index.html").

  6. #6
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi Daniel and Adrian,

    You were right about the "I" in "index.html". I didn't paid attention to that as Dreamweaver named the file like this but it was sure a problem.
    I deleted the htaccess and the redirection works now perfectly (Godaddy does it by default as you said).
    So thanks again for your help,

    Anytime you need a vectorised something, just drop me a line

  7. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    one thing to remember about web development is that the vast majority of webservers are run under linux.
    One of the first reminders of this is that filenames are case-sensitive

  8. The Following User Says Thank You to traq For This Useful Post:

    johnmcjack (09-07-2012)

  9. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Also, as a warning about using Dreamweaver: there's nothing inherently bad about it if you keep an eye on what it does, but if you assume it's doing everything (that is, usually writing code, but also maybe naming files) correctly without double-checking for yourself, you're going to eventually have problems like this.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. The Following User Says Thank You to djr33 For This Useful Post:

    johnmcjack (09-07-2012)

  11. #9
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi Daniel and Adrian

    Thanks for your nice advices, yes i admit relying a bit too much on dreamweaver but as i started learning the code, i hope it will get better and better and i won't make this kind of mistakes again..
    On a totally different subject (but maybe you could also have nice ideas) i may ask you if you know some places/documentation/ forums where people are talking about e-commerce backend management tools (like OsCommerce for example) ?

    Indeed, i'm looking for a simple tool to accept payments for clients and then send them automatically the corresponding product (zip file). Do you have any idea ? I tried OsCommerce but i would have to recreate all my frontend which i don't want to..

    Thanks again, have a nice day!

  12. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You should probably start a new thread for a new question. But in short, I don't think you'll get an answer here. Someone might know, but we don't often have questions about that sort of thing. You can post to check if anyone knows, though
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. Changing index.html to index.php TO-DO list
    By BillTheBuilder in forum Other
    Replies: 0
    Last Post: 03-09-2012, 09:37 PM
  2. index.html page
    By gurmeet in forum PHP
    Replies: 2
    Last Post: 04-09-2011, 05:55 PM
  3. .htaccess 301 redirect to remove index.php
    By chetanmadaan in forum Other
    Replies: 1
    Last Post: 01-23-2011, 06:51 AM
  4. htaccess php html
    By ggalan in forum PHP
    Replies: 14
    Last Post: 12-03-2009, 08:34 PM
  5. Replies: 0
    Last Post: 08-05-2007, 09:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •