我試着去我現有的URL重寫從http://localhost/website/article.php?id=5
到http://localhost/website/article/5
因此,我的htaccess代碼htaccess的資源解釋爲樣式表,但使用MIME類型text/html轉
RewriteBase /website/
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule article/([[email protected]])? article.php?id=$1 [L]
我得到的是 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/website/article/css/bootstrap.min.css".
看樣子即文章被添加到文件的URL中,甚至重定向文件目錄。
真實的URL應該是"http://localhost/website/css/bootstrap.min.css"
林很新的htaccess的,並試圖通過從現有的
修訂複製到創建自己的
我實際的問題是,我的資源,網址是也被重新命名。我已經消除了行代碼下降到2線
RewriteEngine On
RewriteRule article/([[email protected]]) article.php?id=$1
但現在的資源被重定向到不存在的,而不是http://localhost/website/article/js/main.js
http://localhost/website/js/main.js
也許您需要將'/ css/bootstrap.min.css'放入您的標記'link'元素中? –
你知道,條件只用於第一次重寫嗎?文章重寫規則總是被執行 –