2015-09-01 31 views
0

您好I的值有在iirf.iniURL重寫 - 請求URI被設定爲可變

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^/subdir/(.*)$ /subdir/index.php?p=$1 [NC,L] 

預期輸出一個重寫配置應該是從URL www.domain.com/subdir/home轉換應是www.domain.com/subdir/index.php?p=home

但是,輸出是www.domain.com/subdir/index.php?p=index.php?p=home

我們需要產生預期的輸出。

回答

0

我不能評論,所以我要繼續使用答案部分: 請確保在創建鏈接時使用完整路徑。像這樣;的 代替:

<a href="subdir/layout.php"></a> 

確保你正在做的:

<a href="http://localhost/my_project/subdir/layout.php"></a> 

同樣,我不能評論,這就是爲什麼我使用此部分。這不是答案,而是一個建議。請告訴我們,如果是這種情況或不...

+0

嗨,鏈接是這樣的''在我們的重寫文件中它應該被解釋爲'/subdir/index.php?p = home',而是它被解釋爲'/subdir/index.php?p = index.php?p = home' –

+0

您是否嘗試過使用完整版本的鏈接?你可以像這樣做一個URL函數 'define('BASE','http:// localhost/my_project'); function base_URL($ slug =''){ return BASE。'/'。$ slug; }'並使用你的hrefs,如 '' –