2017-10-04 43 views
0

我想我的網站(的Joomla)的單個URL重寫一個友好的URL即改寫.htaccess文件一perticular URL不是基於模式

www.example.com/index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503

www.example.com/favourit

不干擾網站的其他網址

謝謝你的幫助。

+0

這個URL中的數據會改變嗎?我的意思是,如果你直接將它重定向到'favorite',並且'itemid'改爲504,那麼它應該做什麼? –

+0

網址不會改變,如果我輸入'www.example.com/favourit',它應該顯示在上面顯示的冗長的URL –

+0

中顯示的數據,然後下面的答案是正確的,就像它在你的htaccess中一樣,並且/ favourit將起作用 –

回答

1

原題:

嘗試

RewriteRule ^favourit$ /index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503 [L] 

OP彈出一個子文件夾..

如果要移動網站直播,爲example.com假定你已經生活,但你的評論表明你仍然在localhost工作,那麼你應該。

放在根目錄,多數民衆贊成//mysite

RewriteRule ^mysite/favourit$ /mysite/index.php?option=com_mycomponent&view=article&id=10&nav_button=0&article_layout=1&Itemid=503 [L] 

這是暫時的,所以你並不需要修復,一旦你去住。

+0

是的,我已經嘗試過,但出現錯誤, 未找到 未在此服務器上找到請求的URL/mysite/favourit。 Apache/2.4.9(Win64)PHP/5.5.12服務器在本地主機端口80 –

+0

所以它的'/ mysite'前綴是?然後使用RewriteRule^mysite/favourit $ ... –

+0

'http:// localhost/mysite /'這是我的本地站點的主目錄,這就是我想要訪問的友好URL'http:// localhost/mysite/favourit',我已經試過這個'^ mysite/favourit $'但仍然是同一個問題 –