.htaccess htaccess重定向页面而不更改url

.htaccess htaccess重定向页面而不更改url,.htaccess,.htaccess,htaccess是否可以在不更改用户键入的url的情况下重定向用户 http://example.com/sample1.php http://example.com/sample2.php#anchor http://example.com/sample3.php?a=1#anchor # All 3 files open the file main.php but the URL remains the same 我找到了一个答案,但我对它的安全含义持谨慎态度。将此代码放入.htacces

htaccess是否可以在不更改用户键入的url的情况下重定向用户

http://example.com/sample1.php
http://example.com/sample2.php#anchor
http://example.com/sample3.php?a=1#anchor
# All 3 files open the file main.php but the URL remains the same

我找到了一个答案,但我对它的安全含义持谨慎态度。将此代码放入.htaccess可能存在安全漏洞:

RewriteCond  %{REQUEST_URI}   ^/sample1.php [OR]
RewriteCond  %{REQUEST_URI}   ^/sample2.php
RewriteRule   ^.*  /main.php [L]

这会造成威胁吗?还是因为我明确地写下只有sample1.php和sample2.php会被重定向,这样可以吗?

您是在使用apache并重写mod_吗?