2010-06-16 69 views
2

我有一個像網址:mod_rewrite的做短網址

http://skepticalgamer.com/category/slam-the-controller 

我想從網址中去除「類別」。所以我想要:

http://skepticalgamer.com/slam-the-controller 

以充當上面的原始網址。那是可以用mod_rewrite完成的事情嗎?

+0

這是一個WordPress的博客,我相信它是通過重寫完成的。 – 2010-06-16 18:03:11

回答

1

使用輕鬆刪除類別庫,使.htaccess中的更改不必要。該插件不會永久更改數據庫中的URL,因此如果您禁用該插件,則會將您的類別庫重新設置爲無404的帖子。

2

是的,你可以用mod_rewrite的做這樣的事情做到這一點:

RewriteRule ^slam-the-controller$ category/slam-the-controller 

這將需要的網址:

http://skepticalgamer.com/slam-the-controller 

,並改寫爲:

http://skepticalgamer.com/category/slam-the-controller

+0

上述URL是我希望此規則生效的唯一情況。我不希望「任何」以類別爲前綴。我只想讓完整的網址替換爲一個較短的網址。 – 2010-06-16 18:05:17

+0

我明白了,我已經修改了這個特定案例的重寫規則。 – 2010-06-16 18:15:16