-1

我试图让它工作,但我遇到了问题。当我去回显我得到http://localhost/test/demo/的值时。但是当我去的价值是为什么要这样做呢?该文件位于目录内。pdemohttp://localhost/test/demo/moretext/pindex.php/moretext.htaccesstest

Options +FollowSymLinks
RewriteEngine On
RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/(.+?)/$ index.php?p=$1&file=$2
RewriteRule ^(.+?)/$ index.php?p=$1
4

1 回答 1

1

您可以在目录中的一个 .htaccess 文件中尝试此操作/test

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI}  !index\.php       [NC]
RewriteCond %{REQUEST_URI}  ^/test/([^/]+)/([^/]+)/?$ [NC]
RewriteRule .*  /test/index.php?p=%1&file=%2  [L]

RewriteCond %{REQUEST_URI}  !index\.php       [NC]
RewriteCond %{REQUEST_URI}  ^/test/([^/]+)/?$ [NC]
RewriteRule .*    /test/index.php?p=%1  [L]
于 2013-04-08T01:30:14.213 回答