2017-10-21 49 views
0

我的.htaccess文件中有以下重写规则。如何使用htaccess文件隐藏一部分url

RewriteEngine On 
RewriteCond %{HTTPS} !=off 
RewriteCond %{HTTP_HOST} ^example\.com$ 
RewriteRule (.*) http://www.example.com/$1 [R=301,L] 
RewriteRule ^([0-9]+)/([a-zA-Z0-9_-]+)$ system.php?id=$1&title=$2 [L] 

有了这条规则,我得到的网址如下。

http://www.example.com/1111/article-title

我想从URL隐藏“1111”,同时传递一个到system.php作为argument.Also我需要补充,而不是“1111”一些文字。所以我的网址应该如下。

http://www.example.com/text-article-title

有没有办法做到这一点?请在此提供一些见解。

谢谢。

回答

0

试试这个

RewriteCond %{REQUEST_URI} !^example.com/1111/article-title [NC] 
RewriteRule ^example.com/(.*)$ example.com/text-article-title/$1 [L] 

应该做的伎俩。