0

codeigniter フレームワークを使用して Web サイトを再開発しています。

ライブになったら、いくつかの古い URL が新しいサイトの適切なページにリダイレクトされるようにしたいと考えています。

そこで、CodeIgniter が適用する他のルールの上に、正しいルールと思われるものを既存の htaccess ファイルに入れました。

しかし、彼らは影響を受けていません。私がここで欠けているものを誰かが提案できますか?

# pickup links pointing to the old site structure
RewriteRule ^(faq|contact)\.php$ /info/ [R=301]
RewriteRule ^registration\.php$ /register/ [R=301]
RewriteRule ^update_details\.php$ /change/ [R=301]

# Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^_system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

# This snippet prevents user access to the application folder
# Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^myapp.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

# This snippet re-routes everything through index.php, unless
# it's being sent to resources
RewriteCond $1 !^(index\.php|resources)
RewriteRule ^(.*)$ index.php/$1 
4

1 に答える 1

0

[L]ast フラグを R=301 フラグに追加してみてください => [L,R=301] 他のルールが適用されないようにし、念のため、完全な URL にリダイレクトしてみてください。さらに、何も削除していないことを確認するには、RewriteEngine On を一番上に追加し、RewriteBase を設定します。

最初の行を次のようにします

RewriteEngine On
RewriteBase /
RewriteRule ^(faq|contact)\.php$ http://www.YOURDOMAIN.XYZ/info/ [L,R=301]

たとえば、よくある質問ページを呼び出したときに、ブラウザーの URL が変化するかどうかを確認します。

于 2012-05-06T18:50:14.480 に答える