Regex Mod用数字重写URL
我想将一个url从example.php?id=123重写为example-123-hello-worldRegex Mod用数字重写URL,regex,mod-rewrite,Regex,Mod Rewrite,我想将一个url从example.php?id=123重写为example-123-hello-world (其中“hello world”是一些假文本) 我试过这个: RewriteRule ^example-(.*)-(.*)$ /example.php?id=$1 只有在hello world中没有“-”时,它才起作用: example-123-helloworld 有什么办法吗?非常感谢!:) 试试这个: RewriteRule ^example-(.*?)-(.*)$ /exam
(其中“hello world”是一些假文本) 我试过这个:
RewriteRule ^example-(.*)-(.*)$ /example.php?id=$1
只有在hello world中没有“-”时,它才起作用:
example-123-helloworld
有什么办法吗?非常感谢!:) 试试这个:
RewriteRule ^example-(.*?)-(.*)$ /example.php?id=$1
试试这个:
RewriteRule ^example-(.*?)-(.*)$ /example.php?id=$1
以下是您需要使用的内容:
RewriteEngine On
RewriteBase /
RewriteRule ^example\-([0-9]+)\-(.*)/?$ example.php?id=$1 [NC,QSA,L]
以下是您需要使用的内容:
RewriteEngine On
RewriteBase /
RewriteRule ^example\-([0-9]+)\-(.*)/?$ example.php?id=$1 [NC,QSA,L]
您的id是否允许使用任何字符?abc_123是一个有效的id吗?我不知道,id可以有非数字的值。您允许您的id有任何字符吗?abc_123是一个有效的id吗?我不知道,id可以有非数字值