2012-07-19 204 views
0

我對如何做重寫了很多資源,閱讀起來,並取得了一些成功如下:的.htaccess重寫不止一個規則不起作用

RewriteEngine On 
RewriteBase /~me/website.net/html/ 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule ^(.*)$ property.php?property=$1 

...我大概唐「T需要告訴你轉換...

http://imac-i3.local/~me/website.net/html/property-name 

...到....

http://imac-i3.local/~me/website.net/html/property.php?property=property-name  

不管我讀了多少,我想不出接第什麼,我需要做的是轉換HASE ...

http://imac-i3.local/~me/website.net/html/1 
http://imac-i3.local/~me/website.net/html/property/property-name 

要...

http://imac-i3.local/~me/website.net/html/index.php?page=1 
http://imac-i3.local/~me/website.net/html/property.php?property-name 

任何幫助將是非常感激地接受。

回答

0

您想您的規則從RewriteRule ^(.*)$ property.php?property=$1改變:

RewriteRule ^property/(.*)$ property.php?property=$1 [L] 

並添加以下的分頁(它可以是你已經有了規則之後):

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([0-9]+)$ index.php?page=$1 [L]