简体   繁体   English

如何重写此htaccess文件?

[英]How do I re-write this htaccess file?

I got this from this page: https://developers.google.com/commerce/wallet/online/quickstart-php 我是从以下页面获得的: 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 像/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 RewriteBase更改为子目录的名称
  2. Remove the leading slash from the /index.php /index.php删除前导斜杠
  3. Place the rules in an htaccess file in your subdirectory. 将规则放在子目录中的htaccess文件中。

So say your subdirectory is called /subdir and you have http://domain.com/subdir/index.php , you'd have this: 因此,假设您的子目录称为/subdir并且您拥有http://domain.com/subdir/index.php ,则将具有以下内容:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM