我正在尝试使用服务器上的另一个文件代替列表文件zindex.php
该文件必须像在该位置实际存在一样运行。我想我可以用.htaccess做到这一点但是在淘网之后,我没有资源去做这件事。这甚至可能吗?
RewriteEngine On
RewriteCond $1 !^files
RewriteCond %{REQUEST_URI} custom_link_
RewriteRule .* zindex.php
答案 0 :(得分:1)
这将执行zindex.php而不是index.php作为您放置.htaccess的文件夹
RewriteEngine On
RewriteRule ^index.php$ zindex.php
# /index.php will execute /zindex.php
# /index.php?query=string will execute /zindex.php //$_GET['query'] === 'string'
# / will execute /zindex.php
# /folder/index.php will execute /folder/index.php