내 .htaccess에 슬래시 및 비 슬래시 URL을 내 홈페이지에서 .html 모든 URL로 리다이렉트하기 위해 일부 코드를 추가하려고합니다..htaccess 301 비 슬래시 도메인 리디렉션 및 .html로 도메인 슬래시
예를 www.mydomain.com/cat/를 들어및 www.mydomain.com/cat~~HEAD=V은 내에 다음을 추가하기 위해 내가 관리해야
www.mydomain.com/cat.html로 리디렉션합니다. 바로 이곳의 www.mydomain.com/cat.html에 www.mydomain.com/cat을 리디렉션하지만 htaccess로는 슬래시 버전이 .html 페이지
RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://mydomain.com/$1.html [R=301,L]
내 전체 htaccess로 리디렉션하는 방법에 약간의 도움이 필요합니다 누군가가 위의 관점에서 어떻게보아야하는지에 대한 제안이 있다면 크게 좋아할 것입니다. 이 해결
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xxx.xxx.xxx.xx [nc,or]
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://mydomain.com/$1.html [R=301,L]
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
RewriteEngine on
# Pleas note that RewriteBase setting is obsolete use it only in case you experience some problems with SEO addon.
# Some hostings require RewriteBase to be uncommented
# Example:
# Your store url is http://www.yourcompany.com/store/cart
# So "RewriteBase" should be:
# RewriteBase /store/cart
# RewriteBase/
RewriteCond %{REQUEST_FILENAME} !\.(png|gif|ico|swf|jpe?g|js|css)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?sef_rewrite=1 [L,QSA]
</IfModule>
:
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R=301,L]