2

奇妙な問題があります。昨日まですべてが正常に機能していて、突然この問題に気づきました。

webisteはここにあります:http: //www.famtripsandinspectionvisits.com/all_trips

上記のページにアクセスして「india-kerala」リンクをクリックすると、次のページに移動します。

http://www.famtripsandinspectionvisits.com/trips/old_trips/india_kerala

ただし、ブラウザは次のページにリダイレクトします。http: //www.famtripsandinspectionvisits.com/all_trips/old_trips/india_kerala?/trips/old_trips/india_kerala これは、次の部分が追加されたことを示しています。all_trips / old_trips / india_kerala?

.htaac​​cessを確認し、デフォルトにリセットしましたが、それでも影響はありません。cofnig.phpでベースURLを確認しましたが、すべて以前と同じです。誰かが助けてくれるなら、私は感謝します。

私の.htaccessファイル

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]  

Redirect 301 /invest.php http://www.famtripsandinspectionvisits.com/investment_opportunity
Redirect 301 /buyers.php http://www.famtripsandinspectionvisits.com/buyers
Redirect 301 /trips.php http://www.famtripsandinspectionvisits.com/all_trips
Redirect 301 /sellers.php http://www.famtripsandinspectionvisits.com/sellers
Redirect 301 /contact.php http://www.famtripsandinspectionvisits.com/contact_us
Redirect 301 /about.php http://www.famtripsandinspectionvisits.com/about_us
Redirect 301 /login.php http://www.famtripsandinspectionvisits.com/login
Redirect 301 /trip-kerala.php http://www.famtripsandinspectionvisits.com/trips/old_trips/india_kerala
Redirect 301 /trip-burundi.php http://www.famtripsandinspectionvisits.com/trips/up_coming_trips/burundi_africa
Redirect 301 /register.php http://www.famtripsandinspectionvisits.com/register
Redirect 301 /trips http://www.famtripsandinspectionvisits.com/all_trips

私のroutes.php

$route['default_controller'] = "site";
$route['404_override'] = '';

$route['fam_admin'] = "fam_admin/login";
/* End of file routes.php */
/* Location: ./application/config/routes.php */

敬具

4

2 に答える 2

1

ここで行う必要があるのは、mod_rewrite に、新しいクエリ文字列と古いクエリ文字列を結合するように指示することだと思います。これには、QSA フラグを使用する必要があります。

    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [QSA,L]

これが私の Codeigniter プロジェクトの「標準」基本ルール セットであり、残りの部分は、カスタム ルートと時折のリダイレクトで達成できるものと同じです。

(QSA フラグがない場合) 疑問符だけで置換を終了すると、既存のクエリ文字列が消去され、新しいクエリ文字列に置き換えられます。

これに関しては、 mod_rewriteのドキュメントがもう少し詳しく説明されています。

クエリ文字列の変更

デフォルトでは、クエリ文字列は変更されずに渡されます。ただし、クエリ文字列部分を含む置換文字列で URL を作成することはできます。置換文字列内で疑問符を使用するだけで、次のテキストをクエリ文字列に再挿入する必要があることを示します。既存のクエリ文字列を消去する場合は、置換文字列を疑問符だけで終了します。新しいクエリ文字列と古いクエリ文字列を組み合わせるには、[QSA] フラグを使用します。

于 2012-12-07T03:57:30.267 に答える
0

私はこれと同様の問題を抱えていました。次のように編集config.phpしてみてください。

$config['index_page'] = 'index.php?';

私はあなたがCodeIgniterのURLメソッドの1つを使用していて、ホストするためにIISを使用していると仮定しています。「?」を削除する方法がわかりません URLとクエリ文字列の間に「?」を追加します 設定ファイルへのリンクは、少なくともリンクを解決する必要があります。

于 2012-12-07T03:45:04.157 に答える