How to do URLs Case Insensitive? Because I get 300 Multiple Choices.

Discussion in 'Programming' started by nikaway, Jun 6, 2013.

  1. #1
    When I insert the code:


    CheckSpelling on

    In my .htaccess from my domain, and I typed www.mysite.com/Page

    I get it:

    Multiple Choices
    ----------------
    The document name you requested (/index.php) could not be found on this server. However, we found documents with names similar to the one you requested.
    Available documents:
    /index.html (common basename)
    /index.php.bak (common basename)
    Apache Server at www.mysite.com Port 80
    -------------------

    And that error stay for all errors too... e.g if I enter a page not exists, I don't get 404 error Not Found, I get that message 300 Multiple Choices.

    And only URLs lowercase are available...

    What I do? I need help please...
     
    nikaway, Jun 6, 2013 IP
  2. Zarko Dimitrov

    Zarko Dimitrov Greenhorn

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    If you want to check if the file exists simply use the [NC] flag in .htaccess . This ensures there is no duplicate content as yourdomain.com/foobar will return OK if the file exists and 404 if it doesn't.
    You can also use the [NC, L] flag but that will leave you with duplicate content.
     
    Zarko Dimitrov, Jun 6, 2013 IP
  3. nikaway

    nikaway Active Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #3
    Hello Zarko!

    But the file which I'm typing to test that file exists. And don't have duplicate of that.

    Some time ago I had in my .htaccess codes php flags, but it cause Internal Error 500 in my host, then I delete these lines in the code...
     
    nikaway, Jun 6, 2013 IP
  4. Zarko Dimitrov

    Zarko Dimitrov Greenhorn

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    Do you have any .htaccess URL rewrites that are active?
     
    Zarko Dimitrov, Jun 6, 2013 IP
  5. nikaway

    nikaway Active Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #5
    My .htaccess from my domain, in the directory (public_html) have all that code:



    Options -Indexes
    #Não autoriza listagem de pastas
     
    <Files ~ "^\.(htaccess|htpasswd)$">
      deny from all
    </Files>
    #bloquear arquivos especídifos contra acesso pelas URLs
     
     
    <FilesMatch "\.(txt|sql|ini)$">
    Deny from all
    </FilesMatch>
    #bloquear acessar pela URL txt, sql e ini
     
     
    <Files wp-config.php>
    order allow,deny
    deny from all
    </Files>
    #Protege o wp-config de acessos
     
     
     
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mydomain.com
    RewriteRule ^ http://www.mydomain.com%{REQUEST_URI} [L,R=301]
    # Redirecionar URL sem www para www
     
     
     
     
     
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html
    # Replace html with your file extension, eg: php, htm, asp
    #Oculta extensões HTML de páginas
     
     
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.htm -f
    RewriteRule ^(.*)$ $1.htm
    # Replace html with your file extension, eg: php, htm, asp
    #Oculta extensões HTM de páginas
     
     
     
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    # Replace php with your file extension, eg: php, htm, asp
    #Oculta extensões PHP de páginas
     
     
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch bMSIE !no-gzip !gzip-only-text/html
    #Aliviar peso de página para visitantes
     
     
    ErrorDocument 400 http://www.mydomain.com/errors/400.html
    ErrorDocument 401 http://www.mydomain.com/errors/401.html
    ErrorDocument 403 http://www.mydomain.com/errors/403.html
    ErrorDocument 404 http://www.mydomain.com/errors/404.html
    ErrorDocument 500 http://www.mydomain.com/errors/500.html
    #páginas de erro personalizadas
     
     
    redirect 301 /hospede-aqui.html http://www.mydomain.com/blog/hospede-todo-tipo-de-arquivos-gratis-no-dropbox/
    # redireciona URL antiga para URL nova
     
     
    # Protege contra spam bots nos comentários
    # dicas otimas mastermindblogger.com/2011/5-simple-tricks-to-prevent-wordpress-spam-comments
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
    RewriteCond %{HTTP_REFERER} !.mydomain.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
    </IfModule>
     
     
     
     
    RewriteEngine On
    RewriteBase /
    RewriteRule ^wp-admin/includes/ - [F,L]
    RewriteRule !^wp-includes/ - [S=3]
    RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
    RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
    RewriteRule ^wp-includes/theme-compat/ - [F,L]
    # Bloquear contra acessos na área de scripts do wordpress no wp-include
     
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    Code (markup):
     
    nikaway, Jun 6, 2013 IP
  6. Zarko Dimitrov

    Zarko Dimitrov Greenhorn

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    A few solutions to your problem (didn't know you were using Wordpress)
    http://wordpress.org/support/topic/300-multiple-choice-error-cant-find-pages-other-than-index
    http://wordpress.org/support/topic/fixed-site-url-but-now-getting-300-multiple-choices-error
     
    Zarko Dimitrov, Jun 6, 2013 IP
  7. nikaway

    nikaway Active Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #7
    I found a rewrite rule that is causing conflict with the code "CheckSpelling on" and generating Multiple Choices 300!!

    I had to go in testing a rule one by one in. Htaccess, and only when this rule is in. Htaccess file that causes the error!! Without this rule "CheckSpelling on" code works fine!

    See the problem:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    Code (markup):
     
    nikaway, Jun 6, 2013 IP
  8. Zarko Dimitrov

    Zarko Dimitrov Greenhorn

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #8
    Yeah but this is the default Wordpress code - without it WP will not function correctly with SE friendly URLs. Wordpress has its own way of checking if files exist but sometimes it does act weird. Try adding [NC, L] instead of just [L] to these rules.
     
    Zarko Dimitrov, Jun 6, 2013 IP
  9. nikaway

    nikaway Active Member

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #9
    I tried but unfortunately don't works... I try [NC, L] intead of [L] but I get Error Internal Server (500).

    I have a Wordpress in directory /site, but I want to use www.mydomain.com do access it. Then I do it:

    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    It works, i Get good installation in folder "/site" and I get access with www.mydomain.com instead www.mydomain.com / site. But... When I access my html websites in www.mydomain.com/pagehtml/otherpagehtml it don't works... I get a error 404 not found entry in blog...

    Ie installing Wordpress are thinking that my html pages links from other directories I have are links to the posts wordpress site. I think this is all because of some rule in. Htaccess ...
     
    nikaway, Jun 8, 2013 IP