0

これをグーグルで検索しましたが、何も見つかりませんでした。自分で理解することはできません。

私はミニ MVC PHP Freamework を作成し、この .htaccess ファイルを持っています:

DirectoryIndex index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

通常、ブートストラップから URL を取得し、モデルとコントローラーを現在の URL に取得します。

しかし、次のような新しい GET がある場合はどうでしょうか。

if (isset($_GET['topic']))
{
 // echo  the forum topic.
}

現在、URLは次のとおりです。http://domain.com/mvc/forum/topic?topic=this-is-the-topic-title-url

これを htaccess に書き直すにはどうすればよいhttp://domain.com/mvc/forum/topic/this-is-the-topic-title-urlですか?

4

2 に答える 2

0

私はcssファイルを次のように解決しました:

# Allow any files or directories that exist to be displayed directly
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
于 2013-01-30T19:36:28.033 に答える
0

あなたは出来る...

  1. $_GET['url']パラメータを分析$_GETし、プログラム内で配列を動的に変更するか、または
  2. 複数の書き換えルールを操作します。

    # Put this rewrite rule first, because it is more specific, and the
    # second rule will catch anything.
    RewriteRule ^(.+/topic)/(.+)$ index.php?url=$1&topic=$2 [QSA,L]
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
    
于 2013-01-29T18:36:12.683 に答える