下面是我的.htaccess代码:
<VirtualHost *:80>
ServerName api.xxxx.com
DocumentRoot /dianxiaoer/html/two-twenty
<Directory /dianxiaoer/html/two-twenty>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
RewriteRule /notify/alipay /mobile/index.php?act=notify&op=alipay
#Options Indexes FollowSymLinks MultiViews
Options FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
allow from all
</Directory>
</VirtualHost>URL重写规则
api.xxxx.com/notify/alipay to api.xxxx.com/mobile/index.php?act=notify&op=alipay不能正常工作。有人能解释一下我做错了什么吗?谢谢。
发布于 2017-08-14 18:47:11
这一行,RewriteRule . index.php将覆盖它后面的任何内容。
如果你把这个放在最后,那么它应该会解决你的问题。
尝试像这样交换第8行和第9行:
<VirtualHost *:80>
ServerName api.xxxx.com
DocumentRoot /dianxiaoer/html/two-twenty
<Directory /dianxiaoer/html/two-twenty>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /notify/alipay /mobile/index.php?act=notify&op=alipay [L]
RewriteRule . index.php
#Options Indexes FollowSymLinks MultiViews
Options FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
allow from all
</Directory>
</VirtualHost>希望这能解决你的问题。
https://stackoverflow.com/questions/45671009
复制相似问题