1
所以,我有這個的.htaccess代碼(我不知道這是否是寫它的最佳方式):與htaccess的目錄問題
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ index.php?p=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ index.php?p=$1&$2= [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ index.php?p=$1&$2=$3 [L]
而在的index.php我有這樣的代碼加載內容:
<div id="page-wrapper">
<?
$p = ($_GET['p'] ? $_GET['p'] : 'home');
include_once('lib/'.$p.'.php')
?>
</div>
當我訪問www.web.com/home
,例如,它工作正常加載的所有文件;但當我訪問www.web.com/articles/read/asd
,所有其他文件,而不是加載像www.web.com/lib/pixel.png
,它們加載像www.web.com/articles/lib/pixel.png
。
解決此問題的最佳方法是什麼?
您的網站是否生活?如果是這樣,只需發佈您的網站URL。因此,你可以檢查並恢復爲你 – KinjalMistry
這是在本地主機上:/ –
其實你的代碼是好的。我不認爲你必須面對這樣的問題。你能否更清楚你的問題?你是直接訪問圖片還是有鏈接?以及更多.. – KinjalMistry