2015-05-06 50 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