htaccess - 如何找到最后一个连字符

时间:2017-08-26 15:45:43

标签: apache .htaccess

我有两种没有页码的网址: http://example.com/promotional-pens-and-pencils 并与它 http://example.com/promotional-pens-and-pencils-p2

到目前为止,我有这个:

RewriteRule ^promotional-(*)$ /section.php?xName=promotional-$1 [QSA,L]

在这里我需要帮助

RewriteRule ^promotional-()-p([0-9]*)$ /section.php?xName=promotional-$1&xPage=$2 [QSA,L]

由于

1 个答案:

答案 0 :(得分:0)

尝试:

RewriteRule ^promotional-(.*)-p([0-9]+)/?$ /section.php?xName=promotional-$1&xPage=$2 [QSA,L]
RewriteRule ^promotional-(.*)/?$ /section.php?xName=promotion-$1 [QSA,L]