2013-05-09 65 views

回答

0

如果您只需要重寫單個URL,則可以使用簡單的重寫規則。

RewriteRule ^dir1/post.php?%20id=1 category1/post/1 [L] 

,或者您可能需要使用空白字符的正則表達式

RewriteRule ^dir1/post.php?[\s]id=1 category1/post/1 [L] 

您將需要確保mod_rewrite的是也(「RewriteEngine敘述論」在.htaccess),以取代20%。

這裏是一個很好嘖嘖:http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/

+0

非常感謝你的幫助,先生生病試試你的建議是什麼,我...對不起的英語不好......我感謝您的幫助.. godbless – littlekid 2013-05-09 16:52:16

+0

您好..amm我再次問我,如果文件.htaccess的位置[在我的情況下它位於/ public_html]有什麼關於它的影響? RewriteEngine on RewriteRule^dir1/post.php?%20id = 1 category1/post/1 [L] < - 並在上面添加了這一行..即時通訊有點問題想我可能把htaccess文件不正確..謝謝先生 – littlekid 2013-05-10 06:54:05

+0

嘗試用[\ s]替換%20。這是一個空白字符的正則表達式。如果這不起作用,請嘗試[這裏]的建議(http://www.codingforums.com/archive/index.php/t-134799.html)。 – 2013-05-20 21:05:01