2012-05-06 8 views
0

私はcodeigniterフレームワークを使用してウェブサイトを再開発しています。mod_rewriteを使用してCodeigniterで古いURLをリダイレクトする

ライブになると、古い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 

答えて

0

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

あなたの最初の行は

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

のように見えるし、ブラウザでURLを使用すると、インスタンスのFAQページを呼び出すときに変化するかどうかを確認してください。

関連する問題