2015-06-25 146 views
1

在我的服务器的根上,我用htaccess的codeigniter。我已经在codeigniter的子文件夹(例如应用程序,配置文件)中创建了一个wp /文件夹,其中我放置了所有wordpress文件。现在,当有人类型Codeigniter - htaccess重写隐藏wordpress文件夹

www.abc.com 

我重定向他

www.abc.com/wp/ 

,但我想隐藏在url WP。如何在不修改当前文件结构的情况下实现这一目标?我想让wordpress成为我网站的前台,codeigniter是我网站的后端。下面的文件结构如下所示:

enter image description here

+0

为什么不修改你的Codeigniter路由? – CodeGodie

+0

你能复制和粘贴你的命令提示符'树'文件结构 - 命令在这里?这将使我们更好地了解您的目录中实际存在的内容。 – CodeGodie

+0

是的PLZ指南,在这种情况下,我如何修改CI路由。 –

回答

0

在你的根目录下,创建具有以下代码的的.htaccess。这将把你所有的http请求映射到/ wp /目录。

# ==>Initializaion… 
Options -Indexes 
Options +FollowSymLinks 
RewriteEngine On 
RewriteBase/

# ==>Without this line, your /wp/ directory may become visible sometimes 
DirectorySlash Off 

# ==>Map everything to your /wp/ directory 
RewriteRule (.*) /wp/$1 [L] 

您还想从URL中隐藏/ wp/directoy。为此,创建你的/ wp /目录另一个的.htaccess和写入以下行:

# ==>Initializaion… 
Options +FollowSymLinks 
RewriteBase/

# ==>Set default file 
DirectoryIndex index.php 

#==> If the requested resource is NOT a file, or the URL contains “/wp/” anywhere in it, 
# then serve the default file instead 
RewriteCond %{REQUEST_FILENAME} !-f [OR] 
RewriteCond %{THE_REQUEST} /wp/ 
RewriteRule .* index.php [L] 

如果有人类型“/ WP /”,在地址栏的任何地方,他们不会看到它是什么。相反,他们会看到你的主页。

您可能需要调整代码以满足您的要求。