Apache 리디렉션에 약간의 문제가 있습니다. 사이트에서 임의의 페이지에 대해 벨로우즈 규칙이 작동하는 동안 mydomain.com은 후행 슬래시 제거 규칙을 무시하는 mydomain.com//으로 리디렉션됩니다.www가 아닌 www로 리디렉션하면 후행 백 슬래시가 제거되지 않습니다.
또한 이와 같은 여러 규칙을 사용하는 것이 효율적입니까? 아니면 하나의 URL에 여러 번 리디렉션되지 않도록하기 위해 어떻게 결합하거나 연결해야합니까?
감사
당신이 있기 때문에#Turn on options for url rewriting
Options +FollowSymlinks
RewriteEngine on
#lovercase all urls
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteCond %{REQUEST_URI} ^/fonts/.*
RewriteCond %{REQUEST_URI} ^/css/.*
RewriteCond %{REQUEST_URI} ^/js/.*
RewriteRule (.*) ${lc:$1} [R=301,L]
#redirect all requests made to http:// to http://www.
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
#removes trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^\.localhost$ [NC]
RewriteRule ^(.+)/$ http://%{HTTP_HOST}$1 [R=301,L]
은 .htaccess 파일 또는 server/vhost 구성의 이러한 규칙입니까? –
그들은 주 아파치 설정 파일에 있습니다. –