我该如何重写这个htaccess文件?

I got this from this page: https://developers.google.com/commerce/wallet/online/quickstart-php

I am wondering how to re-write it to work in a subdirectory.

like /subdirectory/index.php

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L,NC,QSA]

Here's what you need to do:

  1. Change the RewriteBase to the name of your subdirectory
  2. Remove the leading slash from the /index.php
  3. Place the rules in an htaccess file in your subdirectory.

So say your subdirectory is called /subdir and you have http://domain.com/subdir/index.php, you'd have this:

RewriteEngine On
RewriteBase /subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,NC,QSA]