.htaccess question...

Discussion in 'Site & Server Administration' started by popoman, Mar 2, 2007.

  1. #1
    I'd like to use that in my .htaccess

    # mod_rewrite in use
    Options +FollowSymlinks
    RewriteEngine On
    RewriteCond %{http_host} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?¦php)\ HTTP/ 
    RewriteRule ^(([^/]*/)*)index\.(html?¦php)$ http://www\.domain\.com/$1 [R=301,L]
    Code (markup):
    The first part of domain.com to www.domain.com works fine (btw, Is that ok that the first part doesn't have the slashes before the dots of the url?), but now I'd like to add the second part because I have a large directory filled with pages that interlink to each other's index.html file, so with that second part I'd like to make every link go to directory/ instead of directory/index.html in order to avoid duplicates... Is this code correct and correctly inserted into the .htaccess file? Will it get the job done for all the pages if only inserted to the top-level domain?

    Thank in advance!
     
    popoman, Mar 2, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Search the script for 'index.html' and take it out.
     
    Nintendo, Mar 2, 2007 IP
  3. popoman

    popoman Peon

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks but then what?
     
    popoman, Mar 3, 2007 IP
  4. popoman

    popoman Peon

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Look, then I'm not going to take the index.html out of my pages coz I got over 7,000 of them. Isn't that .htaccess script supposed to work!?
     
    popoman, Mar 3, 2007 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^(.*)/(.*)$ http://www.domain.com/$1/ [R=301,L]

    might change

    domain.com/directory/anything
    to
    domain.com/directory/
     
    Nintendo, Mar 3, 2007 IP
  6. popoman

    popoman Peon

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ok, I'll try that, thank you.
     
    popoman, Mar 4, 2007 IP