2017-08-05 63 views
0

传递参数,目前我的.htaccess文件内容如下如何使用htaccess文件

RewriteRule list/(.*)/(.*)/ list.php?catnm=$1&tnm=$2 
RewriteRule list/(.*)/(.*) list.php?catnm=$1&tnm=$2 

但是这时候我在

之间
www.example.com/list/css/Introduction-of-CSS 

产生与文章网址作品转换成

www.example.com/list.php?catid=css&tid=Introduction-of-CSS 

在我的项目中,我现在生成的URL没有列表关键字

www.example.com/css/Introduction-of-CSS

我应该在我的.htaccess文件中更改哪些内容? 感谢

+0

简单地从重写规则的开头删除'list /'有什么问题? – Mohsenme

回答

0

你可以尝试

RewriteRule ^([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)(/?)$ list.php?catnm=$1&tnm=$2 [NC,L] 
+0

oopsssssss衷心感谢@RamRaider – user2645582

0

在你的.htaccess将这个:

 
    Options +FollowSymlinks 

    RewriteEngine On 

    RewriteRule ^(.*)$ http://small.me/?$1 [L] 

    RewriteRule ^profile/([a-z0-9]+)$ friend.php?username=$1 [NC,L] 
1

您可以使用:

RewriteEngine on 
Options -MultiViews 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^list/([^/]+)/([^/]+)/?$ list.php?catnm=$1&tnm=$2 [QSA,NC,L] 

不包括所有现有文件。
或者你可以使用:

RewriteEngine on 
Options -MultiViews 
RewriteRule ^list/([0-9A-Z_]+)/([0-9A-Z_]+)/?$ list.php?catnm=$1&tnm=$2 [QSA,NC,L] 

不包括与-所有文件。