2015-05-06 48 views
-1

重寫地址欄我想在地址欄只是URL重寫從網址在PHP

https://www.tinycent.com/web/single_post.php?slug=samsung-sprint 

https://www.tinycent.com/web/single_post/samsung-sprint 

任何一個可以幫我爲這件事它需要在還更好的辦法我曾看到

更多10演示在stackoverflow或其他,但他不爲我工作。

+0

http://stackoverflow.com/questions/16388959/url-rewriting-with-php –

+0

嘿卡姆蘭請檢查這張截圖,請http://prntscr.com/724yhf – user2727842

回答

0

你可以做這樣的事情

RewriteEngine On 
    RewriteRule ^web/single_post/([^/]*)$ /web/single_post.php?slug=$1 [L] 
+0

嘿Kamran謝謝你的回覆,但問題並沒有解決,我的意思是這是行不通的....... – user2727842

+0

你能分享你的目錄結構,因此它會提供一個更好的主意,請確保你的Apache mod重定向啓用服務器。 – Kamran

+0

https://www.tinycent.com/web/single_post.php?slug=IPL-2015-RCB-v-MI-Highlights,web是測試的子文件夾,而single_post.php我只需要url https:// www.tinycent.com/web/IPL-2015-RCB-v-MI-Highlights – user2727842