1
我想将一个文件夹的所有无文件和无目录重定向到另一个文件夹。 .htacess应该位于root(http://site.com)上。htacess - 将一个文件夹重定向到另一个内部
例子:
http://site.com/admin/core/file.php - Does not exists. So, redirect (internaly) to http://site.com/adminhide/core/file.php
http://site.com/admin/index.php - Exists. So, don't do anything..
我试图创建的代码,但我有一个500内部服务器错误:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/admin/$
RewriteRule (.*)$ /adminhide/$1 [L]
请帮助我, 谢谢您的时间:)
嘿。不,我希望它是动态的。所以,如果不是/admin/core/file.php是/admin/core/ola.php,它将内部重定向到/adminhide/core/ola.php。与文件index.php相同。我不想不重定向只有index.php文件,但是/ admin /目录中的所有现有文件。谢谢 –
@William更新了我的答案。希望是有用的。 –
您好,我希望它在内部重定向,因此当您输入site.com/admin/core/file.php时,因为它不存在,它会向您显示site.com/adminhide/core/file.php,但地址栏会保留。谢谢。 –