0

URLがwww.xxx.com/theproblem/is-here.html. を取得したいis-here.htmlのですが、このルールでは....

RewriteRule ^([a-z\-\_A-Z0-9]+)/([^/]+)?(?<!\.html)\b/?(([^/]+)\.html)?$ this.php?param1=$1&param2=$2&param3=$3

...param3 の戻り値は ですhere.html。それは、param 2 get is-.

なぜこうなった?

この目標を達成したい:

www.xxx.com/theproblem/is-here.html. -> param1=theproblem | param2=is-here.html
www.xxx.com/theproblem/why-this/ -> param1=theproblem | param2=why-this
www.xxx.com/theproblem/why-this/is-here.html. -> param1=theproblem | param2=why-this | param3=is-here.html

これどうやってするの?

4

1 に答える 1

0

このコードを試してください。それはおそらくあなたが望むものではないかもしれませんが(正規表現のレベルで)、これは機能しています:

RewriteEngine On
RewriteRule ^([^/]+)/([^/]+)/([^.].html)$ this.php?param1=$1&param2=$2&param3=$3 [L]
RewriteRule ^([^/]+)/([^/]+)/$ this.php?param1=$1&param2=$2 [L]
RewriteRule ^([^/]+)/([^.].html)$ this.php?param1=$1&param2=$2 [L]
于 2013-06-20T09:43:11.163 に答える