.htaccess - 按一个文件读取所有子目录和文件

时间:2017-12-14 20:36:07

标签: .htaccess

我正在尝试将.htaccess文件添加到domain.com/links/中,如果有人访问domain.com/links/mylink/或domain.com/links/mylink,则会将其传递到domain.com/links/ link.php?link = xxxxx但我似乎无法找到不会重复的RewriteRule。

RewriteRule ^(.*)$ /links/link.php?link=$1 [L]

以上做了以下内容 domain.com/links/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/的index.php / index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/ index.php的/东西

1 个答案:

答案 0 :(得分:0)

<IfModule mod_rewrite.c>
RewriteEngine On
# If file exists, don't rewrite
RewriteCond %{REQUEST_FILENAME} !-f
# Rewrite everything to link.php
RewriteRule . /links/link.php [L]
</IfModule>