-1

The problem is a slash / "example.ru/aboutus/" translates into a "500 server error" and appends http://example.ru/aboutus/.html at the end of uri.

.HTACCESS

## www.site/index.html ==> site/index.html ##
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^.*/index\.html 
RewriteRule ^(.*)index.html$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

## index.html ==> index ##
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

## index/ ==> index ##
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]

but into enter slash, me drop in to 500 page error


HTML

in the html code pages do not have any links .html extension
`<a href=aboutus>About Us</a>` except `<a href=index.html>index</a>`

QUESTION

  • (is it right?)
  • (can canonical in html help?)
  • (whether you want to Disallow the Robots.txt * .html?)

how to solve the problem that there are no duplicates, so that all pages have been without slashes and extensions .html? all that is needed for seo

1 Answers1

0

found a solution

Options All -ExecCGI -Multiviews -Indexes -Includes +FollowSymLinks

# This tag ensures the rewrite module is loaded
<IfModule mod_rewrite.c>
  # enable the rewrite engine
  RewriteEngine On
  # Set your root directory
  RewriteBase /

# remove the www extension
  RewriteCond %{THE_REQUEST} ^.*/index\.html 
  RewriteRule ^(.*)index.html$ /$1 [R=301,L]
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  # remove the .html extension
  RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP
  RewriteRule (.*)\.html$ $1 [R=301]

  # remove index and reference the directory
  RewriteRule (.*)/index$ $1/ [R=301]

  # remove trailing slash if not a directory
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*)/ $1 [R=301]

  # forward request to html file, **but don't redirect (bot friendly)**
  RewriteCond %{REQUEST_FILENAME}.html -f
  RewriteCond %{REQUEST_URI} !/$
  RewriteRule (.*) $1\.html [L]
</IfModule>

author