0
我在htaccess上寫了RewriteRule(s),它根據參數數量決定它重定向到哪個頁面。根據參數數量決定頁面 - htaccess url rewrite
例如, 「http://mysite.com/tommy」 這將重定向到 「mysite.com/user.php?user=tommy」
然而, 「http://mysite.com/tommy/pets」 會重定向到「mysite.com/show.php? user = tommy & category = pets「
請注意,第一個網址只有一個參數,它會重定向到user.php,而第二個網址有兩個參數,它會重定向到show.php。
請幫忙,並提前致謝!
目前...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]*)/?(.*)$ category.php?userId=$1&category=$2 [QSA,L]
RewriteRule ^(.*)$ user.php?userId=$1 [QSA,L]
</IfModule>
真不明白你在問什麼。 「我正在寫......」你說。如果你已經寫了,那麼問題是什麼?如果你還沒有按照自己的想法工作,請展示你已有的東西。 – Nunser