嗨同行開發者。htaccess如何不重寫某個URL
我正在寫一個混合網站,其中包含靜態網頁,如index.php,page1.php ...和一個Nibbleblog,安裝在靜態網站所在的頂級目錄中。
爲了在博客中啓用搜索引擎優化友好的URL,我已經添加到htaccess以下Nibbleblog推薦的重寫規則。
的RewriteBase /eurotint/new-euroting/app/
是我目前的本地開發目錄
RewriteBase /eurotint/new-euroting/app/
RewriteRule ^category/([^/]+)/page-([0-9]+)$ blog.php?controller=blog&action=view&category=$1&number=$2 [L]
RewriteRule ^category/([^/]+)/$ blog.php?controller=blog&action=view&category=$1&number=0 [L]
RewriteRule ^tag/([^/]+)/page-([0-9]+)$ blog.php?controller=blog&action=view&tag=$1&number=$2 [L]
RewriteRule ^tag/([^/]+)/$ blog.php?controller=blog&action=view&tag=$1&number=0 [L]
RewriteRule ^page-([0-9]+)$ blog.php?controller=blog&action=view&number=$1 [L]
RewriteRule ^post/([^/]+)/$ blog.php?controller=post&action=view&post=$1 [L]
RewriteRule ^post-([0-9]+)/(.*)$ blog.php?controller=post&action=view&id_post=$1 [L]
RewriteRule ^page/([^/]+)/$ blog.php?controller=page&action=view&page=$1 [L]
RewriteRule ^feed/$ feed.php [L]
RewriteRule ^([^/]+)/$ blog.php?controller=page&action=$1 [L]
現在的問題:
這是爲了使搜索引擎友好的URL在博客做工精細,但是,如果我有,例如進入與地址即博客文章,即 websiteAddress/eurotint/new-euroting/app/post/welcome-post/
然後每當我點擊靜態頁面地址(指數,第1頁,第2頁),同時在這個或其他博客頁面即類等的一個
重寫規則地址重定向到類似於: websiteAddress/eurotint /新euroting/app/post/welcome-post/index.php
但我不想重寫靜態地址,即點擊主頁按鈕應該帶我索引頁面websiteAddress/eurotint/new -euroting/app/index.php而不是websiteAddress/eurotint/new-euroting/app/post/welcome-post/index.php
我已經嘗試了一些301重定向文件的名稱,我不想重定向到博客頁面,但他們都沒有工作和tbh。我不擅長Apache重寫規則。
此外,靜態網站的所有圖像網址等也正在重寫,而在博客帖子/類別中,我也想停止它,並且只重新編寫與該網站相關的網址博客。
任何幫助如何實現這一點將非常感謝,謝謝。
嗨,謝謝你的回答,我已經嘗試了你的建議,但是我無法讓它工作。我已經結束了在導航欄中使用完整網址的方式來解決此問題,即我使用了https:// www。 webaddress。 com/filreUrl,我知道這並不理想,但它解決了這個特殊問題。 – Kugarek