Apache 在htaccess重写规则中允许连字符

Apache 在htaccess重写规则中允许连字符,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,目前,此规则不允许在url字符串值上使用连字符。当我从任何url字符串中删除连字符时,它都可以工作 Options +FollowSymlinks ## Mod_rewrite in use. RewriteEngine on ## Prevent Directory Listing IndexIgnore * ## Make pages render without their extension in the url Options +MultiViews RewriteCond %

目前,此规则不允许在url字符串值上使用连字符。当我从任何url字符串中删除连字符时,它都可以工作

Options +FollowSymlinks

## Mod_rewrite in use.
RewriteEngine on

## Prevent Directory Listing
IndexIgnore *

## Make pages render without their extension in the url
Options +MultiViews

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L]

RewriteCond %{REQUEST_FILENAME}  -d
RewriteRule  ^.*$  -  [L]

RewriteCond %{REQUEST_FILENAME}  -f
RewriteRule  ^.*$  -  [L]

RewriteRule ^([-\w]+)?/?([-\w]+)?/?([-\w]+)?/?$ index.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [QSA]

ErrorDocument 404 /404.php
在学习了一些教程之后,我尝试过几次更改规则,但都不起作用

RewriteRule ^([0-9a-zA-Z_-]+)?/?([0-9a-zA-Z_-]+)?/?([0-9a-zA-Z_-]+)?/?$ index.php?p1=$1&p2=$2&p3=$3&p4=$4&p5=$5 [QSA]
示例链接:


如何处理url字符串值中的连字符?

[-\w]+应该可以。您试图访问哪个链接?@hjpotter92@RedVirus您当前的规则应该已经适用于该链接,您遇到了什么问题?您的规则应该从1到3个级别的路径中选择,没有问题。[-\w]表示任何字母数字字符和破折号。您在/mp3系列/文件夹中是否有.htaccess?