0

当前代码:

Options +FollowSymLinks
Options -Multiviews
RewriteEngine On
RewriteRule  ^url-testing/index\.php\?var\=indexs$ /url-testing/indexs.php [L]

原网址:localhost/url-testing/indexs

改写网址:localhost/url-testing/index.php?var=indexs

4

1 回答 1

0

You need to turn your rule around:

RewriteEngine On
RewriteBase   /
RewriteRule   ^url-testing/indexs$   url-testing/index.php?var=indexs [R,L,NC]

Alternatively for a more global rule:

RewriteRule   ^url-testing/(*.?)$    url-testing/index.php?var=$1 [R,L,NC]

You also need to check options for this virtual host, make sure in options that this is set:

AllowOverride All
于 2013-06-04T12:38:29.977 回答