PEAK XOOPS - mod_rewriteでのコメント投稿 in englishin japanese

mod_rewriteでのコメント投稿

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 .2 | Posted on 2006/4/20 13:43
t_yamo  二等兵   Posts: 7
はじめまして。TinyD2.21を利用させて頂いております。

現在、Aliasを使ったサイトに対してWRAP3でコメント可能なページを表示しようとしているのですが、コメントの投稿ボタンを押すと「rewrite/」が外れてしまい、投稿後のページがmod_rewriteによる変換を通さない形で表示されてしまいます。

この対応としてinclude/display.inc.php(TinyD2.21)の182行目に以下のコードを加え、以降の「$mod_url」を「$mod_url_rewrite」に変えたところ、投稿後も「rewrite/」が付くようになりました。

if( ! empty( $xoopsModuleConfig['tc_force_mod_rewrite'] ) || $tmp_array['link'] == TC_WRAPTYPE_USEREWRITE ) {
  $mod_url_rewrite = $mod_url . '/' . substr( $tc_rewrite_dir , 0, -1 ) ;
} else {
  $mod_url_rewrite = $mod_url ;
}

質問1:display.inc.phpを変更せずに投稿後も「rewrite/」が付くように設定することは可能でしょうか。

質問2:上記コードに問題点はありますでしょうか。

※以下に試行環境のhttpd.confの一部を記載します。
Alias /cms "C:\home\files\repo\xoops"
<Directory "C:\home\files\repo\xoops\modules\tinyd0">
  RewriteEngine on
  RewriteBase /cms/modules/tinyd0
  RewriteRule ^rewrite/tc_(.*).html$ index.php?id=$1 [L]
  RewriteRule ^rewrite/(.*.html?)$ rewrite.php?wrap=$1 [L]
  RewriteRule ^rewrite/index.php(.*)$ index.php$1 [L]
  RewriteRule ^rewrite/comment_new.php(.*)$ comment_new.php$1 [L]
  RewriteRule ^rewrite/comment_post.php(.*)$ comment_post.php$1 [L]
  RewriteRule ^rewrite/comment_reply.php(.*)$ comment_reply.php$1 [L]
  RewriteRule ^rewrite/comment_edit.php(.*)$ comment_edit.php$1 [L]
  RewriteRule ^rewrite/comment_delete.php(.*)$ comment_delete.php$1 [L]
  RewriteRule ^rewrite/(.*)$ content/$1 [L]
</Directory>
Windows Server 2003
Apache 2.0.55
PHP 4.2.2
XOOPS Cube 2.0.13a 日本語版
Votes:40 Average:8.25
Previous post - Next post | Parent - No child | Posted on 2006/4/22 4:23
GIJOE  先任軍曹   Posts: 4110
t_yamo さん、こんにちは。

Quote:
現在、Aliasを使ったサイトに対してWRAP3でコメント可能なページを表示しようとしているのですが、コメントの投稿ボタンを押すと「rewrite/」が外れてしまい、投稿後のページがmod_rewriteによる変換を通さない形で表示されてしまいます。
現象、確認しました。

Quote:
この対応としてinclude/display.inc.php(TinyD2.21)の182行目に以下のコードを加え、以降の「$mod_url」を「$mod_url_rewrite」に変えたところ、投稿後も「rewrite/」が付くようになりました。
う〜ん。
これって、コメントリンクを書き換えるんですよね。

正直言って、XOOPSデフォルトのコメント機能は無意味に複雑で、このあたりのリンクを書き換えたときにどうなるか、想像がつかない部分が多々あります。

というわけで、TinyD+mod_rewriteにコメント機能を使うなら、「どこでもXOOPSコメント」との併用が良いと思うのですが…

…ああ、それでも、表示方法を変えただけで、rewrite/が取れてしまいますね。
ちょっと修正してみます。

ご指摘とご提案、ありがとうございました。
Votes:17 Average:5.29
Previous post - Next post | Parent - Children.1 | Posted on 2006/4/22 4:35
GIJOE  先任軍曹   Posts: 4110
一通りテストしてみました。
バッチリですね!

さっそく取り込ませていただきました。
どうもありがとうございました。
Votes:9 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2006/4/24 9:53
t_yamo  二等兵   Posts: 7
2.22をダウンロード致しました。
迅速なご確認+対応ありがとうございます。
Votes:8 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!