2015-04-03 55 views
0

为了削减长话短说,我的网址是这样的一个的.htaccess上的000webhost没有创造短网址

http://example.com/page.php?page_id=20 

而且我要的是URL在本格式

http://example.com/page/20 

这是我的。在000webhost的

RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^page/(.*)[_+?]$ /page.php?page=news&id=$1 [QSA,R,L] 

htaccess的它不工作,我得到404

回答

1

你的模式是接受的URL这样

http://example.com/page/20+

也就是说,我认为不是这样的目标URL一个有效的URL。

试试这个

RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^page/(.*)[_+?]?$ /page.php?page=news&id=$1 [QSA,L] 
+0

谢谢!解决了 – starkeen 2015-04-03 06:29:01