2011-11-10 123 views
0

我的第一天用ExpressionEngine,我知道基本的CodeIgniter。ExpressionEngine 2,管理路徑路由

  1. ./admin.php更名爲./john_doe.php
  2. 更新$配置[ 'cp_url']http://mysite.com/john_doe.php

我想重定向 mysite.com/ johndoe mysite.com/ john_doe.php,只是爲了管理EE2的替代方案。

在笨(可根據用戶指南)這行必須加入到./application/config/routes.php文件:

$route['johndoe'] = "john_doe.php"; 

問題是:我怎樣才能做到這一點在ExpressionEngine?

在此先感謝。

+1

這根本不會幫助你解決問題,但是當我不得不處理EE時,我發現嚴重的代碼點火器知識並沒有幫助我。也可能被遺忘,它與CI有任何關係。 –

回答

0

如果您只想將/johndoe重定向到/john_doe.php,則無需對ExpressionEngine執行任何操作(除非您確實需要)。

相反,只是創建了Apache的.htaccess文件的簡單mod_rewrite規則:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteRule ^johndoe /john_doe.php [R=301,L] 
</IfModule> 

它曾經是很難在EE1 mask access to the Control Panel,但EE 2.2的它很簡單—簡單的包含文件admin.php重命名爲任何你想。

然後使用該文件名在你的URL來訪問控制面板,而不是[更名]的系統文件夾:

http://example.com/Xtr3m-H4x0r.php 

ExpressionEngine將改寫所有的控制面板鏈接的使用蒙面訪問文件名 - - 不過不要忘記編輯文件,以確保路徑到您的系統文件夾設置正確:

$system_path = './renamed-system-folder'; 
+0

雖然.htaccess文件解決方案失敗,但我更喜歡重命名文件解決方案,併爲CP文件提供了一個複雜的名稱和正確的路徑。 – quantme

+0

我只是通過刪除URI上的開始斜槓來修復'.htaccess'規則;完全監督我的部分。它應該現在正確工作。 – rjb

1

的「老派」 —點菜EE1 —方式來馬對EE2中控制面板的sk訪問仍然是可能的。

打開了/system/index.php並取消define('MASKED_CP', TRUE);

/* 
* -------------------------------------------------------------------- 
* MASKED CP ACCESS 
* -------------------------------------------------------------------- 
* 
* This lets the system know whether or not the control panel is being 
* accessed from a location outside the system folder 
* 
* NOTE: If you set this, be sure that you set the $system_path and the 
* 'cp_url' item in the $assign_to_config array below! 
* 
*/ 

define('MASKED_CP', TRUE); 

在同一文件中,取消和以下兩個變量設置爲您的新環境:

$system_path = "./masked-system"; 

$assign_to_config['cp_url'] = 'http://example.com/masked-system/index.php'; 

這是另一種方式面具訪問控制面板

在ExpressionEngine用戶指南中,重命名admin.php的技術要容易得多,建議作爲Post-Installation Best Practice

+0

很多嘗試,並沒有按預期工作,但是是我想解決它的一個有趣的解決方案。 – quantme