2013-10-28 38 views
2

我使用wordpress作爲CMS。我開發了一個定製插件來顯示經銷商信息。如何更改Wordpress中單個頁面的URL?

下面是該網址。

http://example.nl/dealer-info/dealer-informatie/?n=91&d=dealer-name

91是用於獲取從DB中的數據經銷商ID。

我可以改變爲URL如下。

http://example.nl/dealer-info/dealer-informatie/91/dealer-name

http://example.nl/dealer-info/dealer-informatie/?n=91/dealer-name

我的目的是我想補充/dealer-name的URL。

如何更改Wordpress中單個頁面的URL?

鑑於我不想更改將影響整個網站的固定鏈接。我意識到這可以使用.htaccess完成,但我不知道如何去做。如果可能,請幫助我。

回答

0

嘗試:

RewriteEngine On 
RewriteRule ^dealer-info/dealer-informatie/([0-9]+)/(.*)$ /dealer-info/dealer-informatie/?n=$1&d=$2 [L] 

你會希望添加任何WordPress的specificf 之前規則,你的文檔根。

0

如果您的自定義帖子類型是「產品」和/或query_var =「product」,WordPress會查找single-product.php來顯示帖子的單個或永久鏈接。

使用單{} post_type .PHP

更多信息請參考以下鏈接:

http://codex.wordpress.org/Post_Type_Templates