1 つのページで 301 リダイレクトを行う必要があります。www.example.com から動作させたい場合は、次のようにします。
redirect 301 /urisegment1/urisegment2/urisegment3 http://www.example.com/urisegment1/urisegment2/NEWURISEGMENT3
問題は、ユーザーがログインし てSSL-保護されたページ。また、サイトをローカルにセットアップしているので、http://www.example.local/urisegment1/urisegment2/urisegment3からアクセスできます
これをすべてのケースで機能させるにはどうすればよいですか?
(これで質問は終わりです。関連する場合に備えて、現在の.htaccessファイルを以下に示します。ほとんどが私の作品ではなく、さまざまなソースから引き出されていることに注意してください)。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
#Removes trailing slashes (prevents SEO duplicate content issues)
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.+)/$ $1 [L,R=301]
#forces www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#force homepage to http from https
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteCond %{HTTPS} on
RewriteRule ^$ http://www.example.com/ [R=301,L]
#If a controller can't be found - then issue a 404 error from PHP
ErrorDocument 404 /404.html
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^sys.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to index.php. The first condition allows access to assets, css, js and the robots file
RewriteCond $1 !^(index\.php|assets|css|js|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.example.com/$1 [R=301,L]
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>