我正在將客戶端從自定義開發的PHP站點移動到Wordpress。我現在正在使用.htaccess文件中的301重定向來將舊位置移動到Wordpress中的新位置。其中一些正在工作,一些沒有(意味着它提供了「舊」的位置)。我在文件中有標準的「pretty permalinks」mod_rewrite部分,然後是所有的301。301重定向工作隱藏的index.php,但不適用於<file> .php
因此,那些具有像目錄(重新編寫的index.php)列出的原始位置的工作以及具有明確命名的php文件的那些工作不需要。例子:
這工作:
Redirect 301 /about/ http://deanchiropractic.com/about-us/
這確實(仍擔任DR-jon.php):
Redirect 301 /about/dr-jon.php http://deanchiropractic.com/about-us/dr-jon-dean/
我試圖改變周圍的秩序,試圖前後具有301S mod-rewrite部分,嘗試使用和不使用DirectoryIndex行。我還驗證了我正在編輯Web服務器根目錄中的.htaccess。
我寧願讓我的.htaccess工作,而不是把php做301重定向到所有沒有重定向的文件(我試過了,並且驗證了使用一個文件)。
這裏是參考了整個事情:我已經搜查寬
DirectoryIndex index.php index.html
Redirect 301 /about/dr-dean.php http://deanchiropractic.com/about-us/christophe-dean-dc/
Redirect 301 /about/dr-jon.php http://deanchiropractic.com/about-us/dr-jon-dean/
Redirect 301 /techniques/activator.php http://deanchiropractic.com/chiropractic-techniques/activator-method/
Redirect 301 /techniques/cox-technique.php http://deanchiropractic.com/chiropractic-techniques/cox-technique/
Redirect 301 /techniques/active-release.php http://deanchiropractic.com/chiropractic-techniques/active-release-technique/
Redirect 301 /community/dinner-talk.php http://deanchiropractic.com/get-healthy/
Redirect 301 /community/refer.php http://deanchiropractic.com/get-healthy/
Redirect 301 /resources/forms.php http://deanchiropractic.com/forms/
Redirect 301 /resources/faq.php http://deanchiropractic.com/faq/
Redirect 301 /resources/articles/low-back-pain-relief.php http://deanchiropractic.com/low-back-pain-relief/
Redirect 301 /resources/articles/about-the-activator-method.php http://deanchiropractic.com/achieve-wellness-with-the-activator-method/
Redirect 301 /resources/articles/spinal-disc-treatment.php http://deanchiropractic.com/spinal-disc-treatment/
Redirect 301 /resources/articles/headache-relief-benefits.php http://deanchiropractic.com/headache-relief/
Redirect 301 /resources/articles/carpal-tunnel-relief.php http://deanchiropractic.com/carpal-tunnel-relief/
Redirect 301 /resources/articles/neck-pain-relief.php http://deanchiropractic.com/neck-pain-relief/
Redirect 301 /testimonials.php http://deanchiropractic.com/reviews/
Redirect 301 /contact.php http://deanchiropractic.com/contact-us/
Redirect 301 /about/ http://deanchiropractic.com/about-us/
Redirect 301 /techniques/ http://deanchiropractic.com/chiropractic-techniques/
Redirect 301 /community/ http://deanchiropractic.com/get-healthy/
Redirect 301 /resources/ http://deanchiropractic.com/forms/
Redirect 301 /resources/articles/ http://deanchiropractic.com/category/articles/
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
,並在此網站,雖然我已經學到了很多無法找到我確切的問題...匹配有關過程中的.htaccess(仍然是n00b tho)。謝謝....
喬恩,即做到了!我認爲這是這樣的,但是沒有足夠的把握重寫的東西甚至開始遊戲,更不用說理性地理解我的「衝突」了。非常感謝,讓他們現在都工作。 – tinymachine