Mod Rewrite创建假冒或隐藏Wordpress目录

时间:2014-08-08 13:52:26

标签: wordpress apache .htaccess mod-rewrite

我想伪造甚至隐藏我的wordpress目录 mysite.com/wp-content/themes/twentyfourteen/page.php到mysite.com/directory/page.php 甚至mysite.com/wp-content/themes/twentyfourteen/page.php到mysite.com/fake1/fake2/fake3/page.php

在我的.htaccess文件中使用以下命令:

       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^wp-content/themes/twentyfourteen/([^/]+)$ /fakedirectory$1 [L]

我也试过

       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^wp-content/themes/twentyfourteen/([^/]+)$ /fakedir1/fakedir2/fakedir3$1 [L]

但由于某种原因,这不起作用...任何帮助将不胜感激!感谢

1 个答案:

答案 0 :(得分:1)

你正在做相反的事 试试这种方式(假设你的htaccess在根文件夹中)

RewriteCond %{THE_REQUEST} \s/wp-content/themes/twentyfourteen/([^\s]*) [NC]
RewriteRule . /fakedirectory/%1? [R=301,L]

RewriteRule ^fakedirectory/(.*)$ /wp-content/themes/twentyfourteen/$1 [L]