小编Bol*_*las的帖子

具有多个参数的htaccess重写规则

这是我的.htaccess档案:

Options +FollowSymLinks
Options -Multiviews

RewriteEngine On
RewriteBase /website/

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [S=20]

RewriteRule ^(.*)$ $1.php 
RewriteRule ^([a-z0-9_-]+)/([a-z0-9_-]+)(/)?$ index.php?occ=$1&cat=$2
Run Code Online (Sandbox Code Playgroud)

现在这两行一起不起作用:

如果我要去contact.php,我会输入我的网址:localhost/website/contact,它会起作用

但是,如果我想通过在我的url:localhost/website/occasion/category中键入这个来访问location/website/index.php?occ = occasion&cat = category,它将仅在我删除第一个重写规则时有用

但是我不能再去localhost/website/contact了

我在这里想念的是什么?

php .htaccess mod-rewrite

2
推荐指数
1
解决办法
5914
查看次数

标签 统计

.htaccess ×1

mod-rewrite ×1

php ×1