我使用每個User Guide instructions的乾淨網址設置ExpressionEngine 2.4。他們工作得很好。但是,當我使用路徑單變量,如channel entries tag,我仍然在路徑中獲得「index.php」。例如:從某些ExpressionEngine 2路徑中刪除index.php
{exp:channel:entries channel="news"}
..
<a href="{comment_url_title_auto_path}">Test</a>
{/exp:channel:entries}
渲染到:
<a href="http://eetest/index.php/mothra-is-attacking">Test</a>
我目前有由兩個部分組成一個解決方法:
首先,我擦洗 「的index.php」 從URL中使用Find and Replace Plus插件:
{exp:channel:entries channel="news" limit="1"}
<a href="{exp:replace_plus find="index.php/"}
{comment_url_title_auto_path}
{/exp:replace_plus}">Test</a>
{/exp:channel:entries}
這給了我工作的清潔網址:
<a href="http://eetest/mothra-is-attacking">Test</a>
其次,萬一我錯過了模板中的網址,我確信任何有「index.php」的網址都會被重定向到沒有網址的網址。在我的.htaccess我用這個子句:
# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteCond %{THE_REQUEST} ^GET
RewriteRule ^index\.php(.+) $1 [R=301,L]
所以,儘管這個設置工作是凌亂(讓我撒查找/替換我在我的模板中的鏈接),並有點低效(力重定向在某些情況下),和它不完全適合搜索引擎優化(對於使用index.php呈現的那些網址)。
我的問題是,是否有一些設置我錯過了,以防止index.php出現在一些這些路徑中?
下面是我的config.php一些相關設置:
$config['index_page'] = ''; //per the user docs on removing index.php
$config['uri_protocol'] = 'AUTO'; //didn't have luck with the other values
$config['base_url'] = '';
$config['url_suffix'] = '';