mod_rewrite帮助使用多个动态获取

时间:2013-06-05 10:05:34

标签: php apache2

原创= http://ritetag.techreanimate.com/signin.php?network=twitter&fhfghdfghh=sadfgsdf rewrite = http://ritetag.techreanimate.com/signin/twitter?fhfghdfghh=sadfgsdf

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^signin/([^/]*)$ /signin.php?network=$1

我得到了这个工作,但我不能使用得到的其他变量后来,我如何重写为网络以外的东西工作。

1 个答案:

答案 0 :(得分:0)

我解决了!

    RewriteEngine On     RewriteBase /

    #This rewrite has no L flag so the second one can continue
    #Signin.php can have multiple networks like signin/twitter = signin.php?network=twitter
    RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^signin/([^/]*)$ /signin.php?network=$1 [QSA]

    #this rewrite just allows to use files withouth the .php
    # Like about instead of about.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^(.+)$ /$1.php [QSA]